​How to Upgrade to Ubuntu 22.04

Published on

5 min read

Upgrade to Ubuntu 22.04

Ubuntu 22.04 LTS (Jammy Jellyfish) was released on April 21, 2022, and it will be supported for five years. It comes with many new packages and major software upgrades, including the latest versions of OpenSSL, GCC, Python, Ruby, and PHP. This release is based on the Linux 5.15 LTS kernel and adds support for new hardware and filesystems.

The desktop edition comes with kernel v5.17, GNOME 42, and a new screenshot and screen recording tool.

This tutorial explains how to upgrade to Ubuntu 22.04 LTS from Ubuntu 20.04 or Ubuntu 21.10.

Prerequisites

The upgrade operation must be run with superuser privileges. You need to be logged in as a root or a user with sudo privileges . Generally, the user that is created when Ubuntu is first installed has superuser privileges by default.

You can upgrade directly to version 22.04 from Ubuntu 20.04 or Ubuntu 21.10. If you run any previous release, you must first upgrade to Ubuntu 20.04 or 21.10.

Be sure you have a working Internet connection.

Backup Your Data

First and foremost, make sure you backup your data before starting the major upgrade of your operating system. If you are running Ubuntu on a virtual machine, it is best to take a complete system snapshot to quickly restore your machine in case the update goes wrong.

Update Currently Installed Packages

Before starting the release upgrade, it is recommended to update all your currently installed packages to their latest versions.

Packages marked as held back cannot be automatically installed, upgraded, or removed. This may cause issues during the upgrade process. To check whether there are held back packages on your systems, run:

sudo apt-mark showhold

An empty output means there are no held back packages.

If there are on hold packages, you should unhold the packages with:

sudo apt-mark unhold package_name

Refresh the apt list and upgrade all installed packages:

sudo apt updatesudo apt upgrade
If the kernel is upgraded, reboot the machine, and once booted, log back in.

Perform a system upgrade:

sudo apt full-upgrade

apt full-upgrade may remove some currently installed packages that prevents upgrading the system as a whole.

Remove old kernels and all automatically installed dependencies that are no longer needed by any package:

sudo apt --purge autoremove

Upgrade to Ubuntu 22.04 LTS (Jammy Jellyfish)

Upgrading to the latest Ubuntu version is a pretty straightforward process. You can upgrade either from the command line with do-release-upgrade or the GUI update tool.

We’ll perform the update from the command line, which should work for both Desktop and Server systems.

do-release-upgrade is part of the “update-manager-core” package that is installed by default on most Ubuntu systems. If, for some reason, it is not installed on your system, install it with:

sudo apt install update-manager-core
Make sure default upgrade policy in the /etc/update-manager/release-upgrades file is set to “Prompt=normal” or “Prompt=lts”. Otherwise, the upgrade process will not start.

If you are upgrading over ssh and run a firewall on your machine, you need to open the port 1022 temporarily:

sudo iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

Start the upgrade process by entering:

sudo do-release-upgrade

The do-release-upgrade command will disable all third-party repositories and change the apt list to point to the “jammy” repositories. You will be prompted several times to confirm that you want to continue with the upgrade. When asked whether you want the services to be automatically restarted during the upgrade type y.

During the upgrade process, the command will ask you various questions, like whether you want to keep an existing configuration file or to install the package maintainer’s version. If you didn’t make any custom changes to the file, it should be safe to type Y. Otherwise, is recommended to keep the current configuration. Read the questions carefully before making a selection.

The upgrade runs inside a GNU screen session and will automatically re-attach if connection drops.

The whole process may take some time depending on the number of updates and your Internet speed.

Once the new packages are installed, the update tool will ask you if you want to remove the obsolete software. If, you are not sure type d and check the list of obsolete packages. Generally, it is safe to enter y and remove all obsolete packages.

When the upgrade process is complete and assuming all went well, you’ll be asked to reboot your machine. Type y to continue:

System upgrade is complete.

Restart required

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

Continue [yN] y

Confirm the Upgrade

Wait for a few moments until your system boots up and log in.

If you are a desktop user, you will be greeted with a new graphical boot splash and login screen.

You can also check the Ubuntu version by entering the following command:

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04 LTS
Release:	22.04
Codename:	jammy

That’s it. Enjoy your new Ubuntu 22.04 installation.

Conclusion

Upgrading to Ubuntu 22.04 LTS is a relatively easy and painless task.

If you encounter any error, visit the release notes page, which covers the known issues that might happen during the upgrade process.

Feel free to leave a comment if you have any questions.