How to Seamlessly Upgrade Ubuntu 20.04 to 22.04 Without Breaking Your Environment
Configuration drift, stale kernels, and deprecated dependencies—these are the realities faced when running Ubuntu 20.04 LTS past its prime. As upstream support shifts focus to 22.04 (Jammy Jellyfish), the pressure builds to modernize. Yet, any in-place upgrade brings risk: custom services, nonstandard PPAs, and legacy drivers can derail a production environment. Before jumping in, workflow continuity and data integrity should take precedence over speed.
Why Move to Ubuntu 22.04?
- LTS until April 2027: Five years of security fixes and critical patches.
- Kernel 5.15 and beyond: Improved native support for AMD Ryzen, Intel Alder Lake, NVMe, and ext4/xfs optimizations.
- Modern GNOME 42: Fractional scaling, updated Wayland support, better multi-monitor experience.
- Server stack: OpenSSL 3.0, systemd 249, PHP 8, latest PostgreSQL and Docker, plus expanded eBPF capabilities.
For those relying on accelerated GPU workloads, note that NVIDIA driver compatibility is generally improved, but legacy cards may require manual driver pinning.
Pre-Upgrade Hardening: What Veteran Admins Actually Do
Backups: Non-negotiable.
Filesystems can be replaced, data cannot. Create verified, restorable backups. Rsync is serviceable, but for professional scenarios, use Borg, ZFS snapshots, or full-disk imaging for rollback.
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt/external-disk/root-backup-$(date +%F)/
Note: Exclude ephemeral and mountpoint directories to avoid spurious copies.
Update Existing System:
Running outdated packages prior to an upgrade can break dependency chains. Always execute:
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove --purge -y
Kernel reboot:
If uname -r
lags behind apt list --installed | grep linux-image
, reboot now.
PPAs and Foreign Repositories:
Legacy PPAs often cause upgrade holdbacks. List currently enabled sources:
grep -h '^deb ' /etc/apt/sources.list.d/*.list
Purge, comment out, or move aside any sources not directly supporting jammy. Examples that frequently cause issues: graphics-drivers, legacy PHP, Docker-ce, cuda.
App Compatibility:
Inventory your custom packages and check vendor docs for Ubuntu 22.04 support. Proprietary drivers, VPN clients, OBS plugins, and non-mainline kernels are the usual offenders.
Upgrade Workflow
1. Confirm update-manager-core
dpkg -l update-manager-core || sudo apt install update-manager-core
do-release-upgrade
won’t run without it.
2. Set LTS Release Prompt
sudo sed -i 's/^Prompt=.*/Prompt=lts/' /etc/update-manager/release-upgrades
Gotcha: If set to never
or left blank, upgrades aren’t triggered.
3. Start the Upgrade
Run:
sudo do-release-upgrade
If 22.04 isn’t detected, try with -d
to force:
sudo do-release-upgrade -d
Note: Avoid upgrades over SSH unless using tmux
or screen
; interrupted SSH sessions can brick headless servers. If available, console access (e.g., iDRAC/iLO or physical KVM) is preferred.
Installer Prompts:
During package replacement, you’ll see:
Configuration file '/etc/some/app.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
If unsure, keep the existing config. Later diff (.dpkg-dist
and .dpkg-old
) as needed.
Common Upgrade Issues & Recovery
Broken Dependencies:
sudo apt --fix-broken install
sudo dpkg --configure -a
If cyclic dependencies persist, use aptitude
for smarter resolution:
sudo aptitude
Drop into interactive mode and follow suggestions.
Essential Services Fail to Restart:
Logs are under /var/log/apt/term.log
.
Often, postgresql, docker, or web server modules fail due to version mismatches. Look for error lines such as:
E: Sub-process /usr/bin/dpkg returned an error code (1)
Network Failures:
If your upgrade halts mid-transfer, resume with:
sudo dpkg --configure -a
sudo apt update
sudo do-release-upgrade
Post-Upgrade Checklist
-
Kernel Verification:
uname -a # Expect: 5.15.0-XX-generic
-
OS Release Check:
lsb_release -d # Description: Ubuntu 22.04.4 LTS
-
Re-enable compatible PPAs:
Manually vet each. For mission-critical services, test in a clone or staging instance first. -
System Cleanup:
sudo apt autoremove --purge -y sudo apt clean
-
Rebuild/Reinstall Out-of-Tree Kernel Modules:
DKMS modules, VirtualBox, NVIDIA, ZFS may require manual intervention. -
Smoke Test All Workloads:
Don’t trust green boot: run test jobs, check container orchestration, verify DB connections, validate crontabs. For servers, inspect all systemd units:systemctl --failed
Non-Obvious Considerations
- Snap-encroached Apps: Some desktop utilities forcibly migrate from deb to snap (e.g., Firefox). This may affect automation/scripts relying on binaries in typical paths.
- SSH Host Keys: Rare but seen—a failed upgrade can regenerate host keys. If so, remote login scripts and CI runners may distrust the host.
- Disk Space:
/boot
fills up quickly on older installations; free space before upgrades to avoid kernel crashes mid-process.
Bottom Line
Enterprise-grade Ubuntu upgrades aren’t fire-and-forget. Discipline around backups, config management, and staged rollouts is essential. Sometimes, pre-seeding a new 22.04 VM and rsyncing data is safer for heavily customized systems, but with good hygiene, in-place upgrades can work reliably. Never skip the post-upgrade audit.
Known issue: On select Dell and Lenovo hardware, 22.04’s default kernel has sporadic suspend-resume failures. YMMV.
Questions or obscure upgrade failures? Drop a summary and dmesg
snippet below—real fixes, not just theory.