Ubuntu 22.04 LTS (“Jammy Jellyfish”) has just been released! Checkout the release page here.
In this guide we will learn how to safely upgrade from Ubuntu 20.04 LTS (Focal Fossa) or the previous release Ubuntu 21.04 to Ubuntu 22.04 LTS using the command-line
# Step 1 – Backup your data
If you have your important data in your machine, please ensure that you back it up in an external source so you can restore in case of anything. Ensure that your backups are also verified. Most cloud providers provide a way to get a snapshot of the instance, if you are using cloud, please take advantage of that as well.
Also, since large packages will be downloaded, ensure that you have enough space in your machine. Always ensure that you have at least 20GB disk space on your machine. You can use this command df
to verify:
➜ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 781M 2.4M 779M 1% /run
/dev/mapper/vgubuntu-root 233G 15G 207G 7% /
tmpfs 3.9G 211M 3.7G 6% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/nvme0n1p2 512M 5.3M 507M 2% /boot/efi
tmpfs 781M 1.4M 780M 1% /run/user/1000
Since the upgrade process can take a lot of time, always ensure that you have good internet before proceeding and do not cancel once the process starts, this will leave the machine in an inconsistent state. Ensure you are running the server on UPS or your laptop battery is fully charged and to avoid data loss on your desktop, close all apps, including browser windows.
All third party mirrors and repositories are commented out during the upgrade process, making them disabled. For example, Google Chrome repo and others will get disabled. You need to enable them after the upgrade procedure is completed. You can find 3rd party repos or mirros in the /etc/apt/sources.list.d/ directory.
# Step 2 – Update your system
Next, update the current system packages to ensure that they are all latest. Use this command:
sudo apt update
sudo apt upgrade
If a new kernel is installed in the system, reboot the instance to use it. Use this command to reboot:
sudo reboot
# Step 3 – Upgrade to 22.04 LTS using the command line
On the command line, type the do-release-upgrade command as follows to start the update procedure:
sudo do-release-upgrade
Since this is a new release, you might get this error:
➜ sudo do-release-upgrade
Checking for a new Ubuntu release
No new release found.
This is because Upgrades between LTS releases are not enabled by default until the first point release, 22.04.1. It is recommended that most LTS users wait until then before upgrading to 12.04.
f you choose to upgrade before then, you can pass the -d
option to the upgrade tool, running do-release-upgrade -d
or update-manager -d
, to 12.04. (-d
stands for devel.)
sudo do-release-upgrade -d
# Confirming upgrade procedure
Again you will get final prompt with details as follows:
Do you want to start the upgrade? 14 installed packages are no longer supported by Canonical. You can still get support from the community. 5 packages are going to be removed. 90 new packages are going to be installed. 570 packages are going to be upgraded. You have to download a total of 546 M. This download will take about 1 minute with a 40Mbit connection and about 14 minutes with a 5Mbit connection. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d] y
Finally hit the ENTER again:
It is highly recommended that the lock screen be disabled during the upgrade to prevent later issues. Please ensure your screen lock is disabled before continuing. To continue please press [ENTER]
Also make sure you confirm to restart services when asked. For example, do you want to keep your existing sshd config file?
# System upgrade is complete
After some time, you will get confirmation on the screen. A restart is required to finish the upgrade from 20.04 LTS/21.10 to 22.04. Make sure you choose y, and then Ubuntu will restart.
# Step 4 – Verification ↑
Once the system is restarted, you can log in using GUI or ssh based session. Then you can view the Linux kernel version, run:
uname -mrs
You can use the lsb_release command too:
lsb_release -a
# Step 5 – Enable 3rd party repos/mirrors
Now that Ubuntu upgrade is completed, make sure 3rd party mirror and repos are enabled. Otherwise, you will not get updates. Use the cd command as follows:
cd /etc/apt/sources.list.d
ls -l
For example, my app repo was disabled during updates:
cat the-app.list
Outputs:
#deb [arch=amd64] https://dl.citizix.com/linux/deb/ stable main
To enable it again, I commented out the line by removing the #:
deb [arch=amd64] https://dl.citizix.com/linux/deb/ stable main
Finally, run the apt update and upgrade
sudo apt update
sudo apt upgrade
And you should be good now. Check if all the apps works as expected otherwise the upgrade is complete.