Upgrading Ubuntu to a new release can bring new features and security fixes, but it can also disrupt a working system if something goes wrong. This guide walks you through a safe upgrade process, from preparation to execution, and shows you how to recover if the upgrade fails or leaves your system in a broken state.
What You’ll Need
- A computer running a supported Ubuntu release (e.g., 22.04 LTS or 24.04 LTS) with at least 10 GB of free disk space.
- A stable internet connection (wired is recommended over Wi-Fi).
- Administrative (sudo) access to the system.
- An external backup drive or cloud storage for important files.
- Your login password and, if you use full-disk encryption, the encryption passphrase.
Step-by-Step
- Back up your data. Copy important documents, photos, and configuration files (e.g.,
~/.bashrc,~/.ssh,/etc/fstab) to an external drive or cloud service. You can usersyncor the built-in Backup tool. - Update your current system. Open a terminal and run:
sudo apt update sudo apt upgrade sudo apt dist-upgrade
This ensures your current release is fully patched, reducing the risk of upgrade conflicts.
- Clean up unnecessary packages. Run
sudo apt autoremoveandsudo apt autocleanto free space and remove obsolete packages. - Check disk space. Use
df -hto confirm you have at least 10 GB free on the root partition. If not, remove large files or expand the partition. - Disable third-party PPAs and proprietary drivers. Some PPAs may not support the new release and can cause conflicts. Open Software & Updates > Other Software and uncheck all PPAs. Also, under Additional Drivers, switch to the open-source driver if a proprietary one is active (you can re-enable later).
- Start the upgrade. For a GUI upgrade, open Software & Updates > Updates and set Notify me of new versions to Any new version. Then run
sudo do-release-upgradein a terminal. For a clean command-line upgrade, usesudo do-release-upgrade -donly if you want the development release. - Follow the prompts. The upgrade will ask about services to restart and configuration files to replace. Read each prompt carefully; when asked about a config file, choose keep the existing version unless you know the new one is needed.
- Wait for completion. The process can take 30 minutes to several hours depending on your internet speed and hardware. Do not interrupt it. If the screen appears frozen, wait—it may still be working.
- Reboot when prompted. After the upgrade finishes, reboot. If the system boots normally, verify the version with
lsb_release -a. - Re-enable PPAs and drivers. After a successful upgrade, re-add the PPAs you disabled and reinstall proprietary drivers if needed.
Common Mistakes
- Skipping the backup. The most common and costly mistake. Always back up before upgrading.
- Upgrading with low disk space. This often causes the upgrade to fail midway. Check space beforehand.
- Ignoring third-party sources. PPAs and manually installed packages can break the upgrade. Disable them first.
- Interrupting the upgrade. Closing the terminal or losing power during the upgrade can corrupt the system. Use a UPS if possible.
- Not reading prompts. Blindly accepting all prompts can replace custom configs with defaults, losing your settings.
Tips
- Use a wired internet connection to avoid dropouts.
- Perform the upgrade from a terminal (
sudo do-release-upgrade) rather than the GUI, as it gives clearer output and can be resumed more easily. - If you have a laptop, keep it plugged in during the upgrade.
- Take a system snapshot if you use LVM or btrfs—this allows easy rollback.
- Wait a few weeks after a new release before upgrading to allow early bugs to be fixed.
Troubleshooting
Upgrade fails with dependency errors. Run sudo apt --fix-broken install and then sudo apt update again. If the issue persists, try sudo dpkg --configure -a.
System boots to a black screen. At the GRUB menu, select Advanced options and choose a previous kernel. If that works, you can reinstall the new kernel later. If not, boot into recovery mode and select network, then root, and run sudo apt update && sudo apt upgrade.
GUI does not start. Press Ctrl+Alt+F2 to switch to a text console, log in, and run sudo apt install --reinstall ubuntu-desktop.
No network after upgrade. Reinstall the network manager with sudo apt install --reinstall network-manager and reboot.
Package manager is locked. If you see Could not get lock /var/lib/dpkg/lock, remove stale lock files with sudo rm /var/lib/dpkg/lock and sudo rm /var/lib/apt/lists/lock.
If all else fails, restore from backup. Reinstall Ubuntu from a live USB and copy your backed-up files back. This is the most reliable recovery method.
Frequently Asked Questions
Q: How long does an Ubuntu upgrade take?
A: Typically 30 minutes to 2 hours, depending on your internet speed and hardware. Large downloads and package installation are the main time consumers.
Q: Can I upgrade directly from 20.04 to 22.04?
A: Yes, but it’s safer to upgrade one LTS at a time (20.04 → 22.04). You can skip intermediate non-LTS releases.
Q: Will my applications and settings be preserved?
A: Yes, in most cases. The upgrade keeps your home directory and installed packages. However, some packages may be removed if they are incompatible with the new release.
Q: What if I lose power during the upgrade?
A: If the system is interrupted, boot into recovery mode and run sudo dpkg --configure -a to finish configuring packages. Then run sudo apt update && sudo apt upgrade.
Q: Is it safe to upgrade with proprietary drivers installed?
A: It’s safer to disable them before upgrading, as they may not support the new kernel. You can reinstall them after the upgrade.
Q: Can I cancel an upgrade after it starts?
A: It’s not recommended. Let it finish. If you must cancel, you risk a broken system. If it fails, use the troubleshooting steps above.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Photonic Inference vs GPU Inference: Key Differences16,384.00 µs
- Android Low Storage Survival Tips That Actually Work
- How to Password Protect PDFs on iPhone
- iPhone Force Restart Not Working? Fixes
- Add or Remove Keyboard Layout in Windows 10
- Razer Barracuda V2 Pro Dongle: Store & Find