How to Upgrade Ubuntu 20.04 to Ubuntu 22.04

Ubuntu 22.04 has been released by Canonical in what could be considered the release of the year because of how important this distribution is for the whole Linux world. That is why many people choose to install it from scratch. However, there are others who prefer to upgrade from Ubuntu 20.04 Well that’s what we will do in this post, as you will learn how to upgrade from Ubuntu 20.04 to Ubuntu 22.04.

A long-awaited release

Ubuntu 22.04 is the new LTS of Ubuntu, which in turn is one of the most significant operating systems not only on Linux but in the entire world. It comes loaded with many new features and updates to the main components of it.

In addition to this, it will serve as a base for the also awaited Linux Mint and ElementaryOS, so in the desktop environment we are in the presence of a significant release.

Regarding servers, Ubuntu is also making its presence felt and wants to position itself as an alternative to the established Debian and CentOS. It wants to achieve this with professional support, but also with an easy administration of the system without giving up security and stability.

So as we can see, this was a long-awaited release for all Linux enthusiasts and Linux related professionals.

Tips before starting the process

The Ubuntu upgrade process has undergone changes for the better, and this can be seen in the length of time it takes and the few bugs that can occur. However, despite the advances, it is still a process that is capable of failure.

Because of the above, you should make a backup of all the important data you have in the system; in addition to this, do the procedure with time available because we will not be able to stop it once the process starts.

Another aspect to keep in mind is that we have to disable all third-party repositories to make the process as efficient as possible.

If you are going to perform the process in the desktop version, you have to close all applications and leave the terminal alone.

With this in mind, we can start.

Preparing the system for the upgrade

The first thing we have to do is to completely update the distribution

apt update
apt upgrade

If you have marked packages to be withheld from an upgrade, you need to unhold them using this command

apt-mark unhold [package 1] [package 2] [...]

To find out which packages you have with this behavior, you have to run

apt-mark showhold

With the system already upgraded, we now need to check the behavior of the system updater. To do so, open the configuration file.

cat /etc/update-manager/release-upgrades

Check if the Prompt value is lts. If not, edit it and set it to that value.

If we are doing the process in an SSH session, then we need to open a port for an extra session. The port mentioned is 1022.

ufw allow 1022/tcp

Upgrade Ubuntu 20.04 to Ubuntu 22.04

Now run the upgrader using the following command

do-release-upgrade -d

The first thing you will be asked about is the port and SSH session. As we have already done this procedure, you can answer Y without problems.

Continue running under SSH? 

This session appears to be running under ssh. It is not recommended 
to perform an 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 
'1022'. 
Do you want to continue? 

Continue [yN] 

Next, the repository will be changed to the new version.

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]

Then the installer will give you a summary of the packages and the installation:

You have to download a total of 519 M. This download will take about 
1 minute with a 40Mbit connection and about 13 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]

Next, to prevent issues, it is recommended that you disable the screen lock.

This will start the whole installation process. You will also be asked if you want to restart all services automatically during the process.

Upgrade Ubuntu 20.04 to 22.04
Upgrade Ubuntu 20.04 to 22.04

Then have a cup of coffee because the entire process of downloading and updating the system will continue.

If you are asked to replace some configuration files, my recommendation is N to keep the one you already have.

Upgrading Ubuntu
Upgrading Ubuntu

At the end, you will have to restart the system.

Restart required 

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

Continue [yN] 

When it starts up again, you can check that you have Ubuntu 22.04 by running the command

lsb_release -a
Ubuntu 22.04
Ubuntu 22.04

As you can see, the process is simple, and we will be able to use our new system.

Conclusion

Every day Linux is getting easier to use. For example, now upgrading between LTS versions of a system like Ubuntu is a simple process.

I hope you liked this post, and now you can enjoy the brand new Ubuntu 22.04.

Share This:

Leave a Comment

Your email address will not be published.