Rescuing a Stalled Ubuntu LTS do-release-upgrade

Share this Guide

Overview

An aborted SSH connection left my do-release-upgrade half-done and the system stuck in a loop of “dpkg was interrupted” errors. By hiding /var/lib/dpkg/info, running apt-get -f install, and restoring the directory, I completed the upgrade without reinstalling the OS. This guide explains each step, what lives inside the info directory, other causes of failed upgrades, and best practices to avoid the problem next time.

Why Ubuntu LTS Upgrades Fail

1. Lost SSH or Console Sessions

Although do-release-upgrade spawns a screen session, a broken network path can still leave packages half-configured if you disconnect before it reaches a safe checkpoint.

2. Low Disk Space

The upgrader needs several gigabytes for .deb files and unpacked trees; if /, /var, or especially /boot is full, dpkg aborts mid-transaction.

3. Third-Party PPAs and Local Builds

Out-of-date PPAs or self-compiled packages can introduce dependency versions that Jammy cannot satisfy, causing the upgrade to roll back.

4. Package Database Corruption

Power loss, kernel panic, or manual termination while dpkg writes status files can corrupt entries under /var/lib/dpkg, leading to the classic configure-a prompt.

5. Stale Lock Files

Residual locks under /var/lib/apt/lists/lock or /var/cache/apt/archives/lock can block any further package operations.

What’s Inside /var/lib/dpkg/info?

Each installed package stores maintainer scripts (preinst, postinst, prerm, postrm), a list of installed files, and hash checksums in this directory. If a script is only partially written, dpkg will stop on every attempt to finish configuration.

Step-by-Step Repair

CommandPurpose
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_silentIsolates broken scripts so dpkg can’t execute them.
sudo mkdir /var/lib/dpkg/infoProvides an empty staging directory for new metadata.
sudo apt-get updateRefreshes the package index against Jammy mirrors.
sudo apt-get -f installForces dependency resolution, unpacks missing packages, and reruns any pending postinst scripts.
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_silentPrevents mixing newly generated files with the old set.
sudo rm -rf /var/lib/dpkg/infoRemoves the placeholder.
sudo mv /var/lib/dpkg/info_silent /var/lib/dpkg/infoRestores a now-consistent metadata directory.

Why it Works – With maintainer scripts out of the path, dpkg simply records that they ran successfully and continues the upgrade. Afterward, legitimate metadata is merged back, leaving future package operations intact.

Other Quick-Fix Scenarios

SymptomCure
Only database interruptedsudo dpkg --configure -a
Disk full in /bootsudo apt-get autoremove --purge old kernels
PPA dependency loopsudo ppa-purge ppa:user/ppa then retry upgrade
Bad mirror or partial downloadsRevert sources.list to previous release, apt update, retry upgrade

Preventing the Problem Next Time

  1. Run inside tmux or screen before you start.
  2. Clean and check free space with apt clean and df -h
  3. Disable unsupported PPAs until maintainers publish Jammy packages
  4. Apply all pending updates first: apt update && apt full-upgrade
  5. Snapshot the system (VM, ZFS, LVM) for instant rollback.
  6. Use non-interactive flags if automating: DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade

Conclusion

A dropped SSH session left my Ubuntu upgrade in limbo, but a simple metadata shuffle brought dpkg back to life. By understanding the role of /var/lib/dpkg/info and letting apt-get -f install finish the heavy lifting, you can usually rescue a stalled LTS hop without reinstalling. Follow the preventive checklist and your next upgrade should complete smoothly.

Article Written By

I am a B.Tech Computer Science Engineer with 7+ years of robust experience in Full Stack Development and IT Infrastructure. Based in Pilani, Rajasthan, I specialize in Home Automation (IoT), Linux Server Administration, and Solar Power Systems. Unlike generic tech blogs, I physically build and test every project on this site - from wiring 2kVA Solar inverters with IoT to coding custom ESP32 firmware and managing self-hosted homelab to being a gaming pro. My work focuses on practical, real-world engineering solutions for makers and developers. Expertise: Python, Docker, ESP32/Arduino, Linux (Debian/Ubuntu), 3D FDM Printing (Bambu Lab), POC Engineering. Current Projects: Making decentralization popular and accessible.

Leave a review

Reviews (0)

N�j�brW���'��y����{ 2z
Pilāni
few clouds
28.7 ° C
28.7 °
28.7 °
18 %
3.9kmh
15 %
Mon
32 °
Tue
34 °
Wed
36 °
Thu
36 °
Fri
36 °

Related Posts

How to Get the Best FPS in CS2 on Any PC (Ultimate Settings Guide)

This comprehensive guide covers all CS2 video settings that impact performance and quality to Get the Best FPS in CS2 on Any PC

Helldivers 2 Weapons Tier List | All Guns Ranked & Best Uses

This updated Helldivers 2 Weapons Tier List August 2025 ranks every primary and secondary weapon, including Warbond weapons – from S-tier to D-tier. Discover each gun’s stats, strengths, and best scenarios (which factions or missions they excel in) so you can optimize your Helldivers 2 loadout and bring Democracy to the enemies of Super Earth with the right firepower!

Comprehensive Guide to Bambu Lab 3D Printers Lineup (2025)

Bambu Lab has rapidly become a leading name in...

Bambu Lab Calibration Guide (P1, X1, A1 Mini & H2D)

Bambu Lab’s 3D printers are renowned for their automated...

Raspberry Pi Automatic Fans Using L298n PWM

Welcome, We all know Raspberry Pi SBC Likes to...

YouTube on Kodi: Setup Personal API

You have installed latest version of Kodi on your...
- Advertisement -spot_img