How to upgrade from Ubuntu 20.04 LTS to 22.04 LTS


Ubuntu 22.04 was released on April 21, 2022.
What are you waiting for to upgrade your Ubuntu 20.04 LTS to the next version?
In this guide, we will tell you how to do it safely.

Make sure the update manager is set to update to LTS versions.

cat /etc/update-manager/release-upgrades

If the output is the following “Prompt=lts” you can proceed with the guide.

Upgrade your system

Before updating your current version of Ubuntu to the next, make sure you have all the latest packages released.
Run these commands, your server / pc will reboot and then we can proceed with the guide safely.

If you are working as root user

apt update && apt full-upgrade -y && apt autoremove -y && apt autoclean && shutdown -r now

If you are working as normal user

sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt autoclean && shutdown -r now

Upgrade from Ubuntu 20.04 LTS to Ubuntu 22.04 LTS

Before updating your current version of Ubuntu to the next, make sure you.

If you are working as root user


If you are working as normal user

sudo do-release-upgrade

You will see this message:

Reading cache
Checking package manager
Continue running under SSH? 
This session appears to be running under ssh. It is not recommended 
to perform a upgrade over ssh currently because in case of failure it 
is harder to recover. 
If you continue, an additional ssh daemon will be started at port 
Do you want to continue? 
Continue [yN] y

Type ‘y’ and hit enter

Starting additional sshd 
To make recovery in case of failure easier, an additional sshd will 
be started on port '1022'. If anything goes wrong with the running 
ssh you can still connect to the additional one. 
If you run a firewall, you may need to temporarily open this port. As 
this is potentially dangerous it's not done automatically. You can 
open the port with e.g.: 
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' 
To continue please press [ENTER]

Hit enter to proceed

Do you want to rewrite your 'sources.list' file anyway? If you choose 
'Yes' here it will update all 'focal' to 'jammy' entries. 
If you select 'No' the upgrade will cancel. 
Continue [yN] y

Type ‘y’ and hit enter

Again you will get final prompt as follows:

Do you want to start the upgrade? 
xx installed packages are no longer supported by Canonical. You can 
still get support from the community. 
x packages are going to be removed. xx new packages are going to be 
installed. xx packages are going to be upgraded. 
You have to download a total of xxx M. This download will take about 
x minute with a xxMbit connection and about xx minutes with a xMbit 
Fetching and installing the upgrade can take several hours. Once the 
download has finished, the process cannot be canceled. 
 Continue [yN]  Details [d] y

Type ‘y’ and hit 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]

Press ENTER to start the system update.

It is likely that during the upgrade procedure, you will be asked to remove obsolete packages.

Searching for obsolete software
Reading state information... Done
Remove obsolete packages? 
xx packages are going to be removed. 
 Continue [yN]  Details [d]

Type ‘y’ and hit enter.

After some time, you will get following text.
A restart is required to finish the upgrade from 20.04 LTS to 22.04 LTS.

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Type ‘y’ and hit enter.

You have completed the update, now to verify the correct update of your system run this command

lsb_release -a

If “Release” is 22.04 you have successfully updated your system.