Ubuntu 22.04 LTS (“Jammy Jellyfish”) is released now. This tutorial explains how to safely upgrade from Ubuntu 20.04 LTS (Focal Fossa) to Ubuntu 22.04 LTS using the command-line and GUI options.

Backup all your data before upgrade from Ubuntu 20.04 (Focal Fossa) to Ubuntu 22.04 (Jammy Jellyfish)

  • Make sure you keep all verified backups of important files and databases. Most cloud server providers like Linode or AWS have an option to make snapshots. So take advantage of such service.
  • Also, make sure you have free disk space. For example, I always ensure that I have at least 30GB of free disk space on my VM. Use the df command:
    $ df -H
  • The upgrade process takes its sweet time due to the speed of the internet and other factors. Please do not cancel the operation once started, as it will leave your Ubuntu machine in an inconsistent state.
  • Ensure you are running the server on UPS or your laptop battery is fully charged.
  • To avoid data loss on your desktop, close all apps, including browser windows. For example, I closed my Firefox on Ubuntu Linux 20.04 LTS desktop.
  • 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.
  • I tested instructions on Ubuntu Linux 20.04 LTS server and desktop.

What’s new in Ubuntu 22.04 LTS?

New features and apps that care about most:

  • Apache 2.4.52
  • BIND 9.18
  • Corosync 3.16
  • Django 3.2.12
  • Firefox 99 (Firefox is now only provided in Ubuntu as a snap)
  • GNOME has been updated to include new features and fixes from GNOME 41 and GNOME 42
  • LibreOffice 7.3
  • Linux kernel v5.15.0-25
  • MySQL 8.0.28
  • NetworkManager 1.36
  • nftables is default as backend for the firewall
  • Pacemaker 2.1.2
  • Perl v5.34.0
  • PHP 8.1.2
  • PostgreSQL 14.2
  • Python 3.10.4
  • Ruby 3.0
  • Samba 4.15.5
  • ssh-rsa is now disabled by default in OpenSSH.
  • Thunderbird 91

Upgrading from Ubuntu 20.04 LTS to 22.04 LTS

WARNING! Make a backup. Do not proceed further without backups. The nixCraft is not liable for failed upgrade procedures and data loss.

Check /etc/update-manager/release-upgrades file (needed for both GUI and CLI methods)

Check for default behavior for the release upgrader by using the cat/more or less command:
$ less /etc/update-manager/release-upgrades
And make sure the following line is set to lts:

Prompt=lts

The procedure is as follows to upgrade Ubuntu 20.04 to 22.04.

Step 1 – Update your system

Open the terminal application. For remote server log in using the ssh command. First, find all packages that are on hold, type the apt-mark command:
$ sudo apt-mark showhold
If you see an empty output, there are no held back packages, and you can proceed safely. Otherwise, you need to remove a hold on packages using the apt-mark command. For instance, unhold the packages as follows (replace pkg1 pkg2 with actual names):
$ sudo apt-mark unhold pkg1 pkg2
Next, update current system using the apt command:
$ sudo apt update #<--Refresh the apt repo
$ sudo apt upgrade #<--Now apply all upgrades

How to ugprade and patch Ubuntu 20.04 LTS

Patching Ubuntu 20.04 LTS

Reboot the Ubuntu Linux box if a new Linux kernel is installed on the system using the shutdown command or reboot command:
$ sudo reboot

Step 2 – Note down the current Linux distro name and kernel version 

Use the uname command and lsb_release command as follows:
$ uname -mrs
$ lsb_release -a

Note down Ubuntu Linux 20.04 LTS kernel version command

Finding out Ubuntu Linux kernel version

Step 3 – Open TCP port 1022 

Are you typing the following commands over ssh based session? Then, please open an additional ssh port using ufw command which will be started at port 1022. For example:
$ sudo ufw allow 1022/tcp comment 'Open port ssh tcp port 1022 as failsafe option for upgrades'
Verify it:
$ sudo ufw status
Sample rules:

Status: active
 
To                         Action      From
--                         ------      ----
1022/tcp                   ALLOW       Anywhere                   # Open port ssh tcp port 1022 as failsafe option for upgrades
22/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
1022/tcp (v6)              ALLOW       Anywhere (v6)              # Open port ssh tcp port 1022 as failsafe option for upgrades
22/tcp (v6)                ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)

Step 4 – 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

If you do not get updates, try to pass the -d. If using the latest supported release, upgrade to the development release. For example:
$ sudo do-release-upgrade

ssh user will see message immediately:

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 
'1022'. 
Do you want to continue? 
 
Continue [yN] y

Type ‘y’ and then you will get another message:

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]

Since we already opened port 1022, press the [Enter] key to continue. Then you need to confirm focal to jammy update entries:

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

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]
Keep sshd config on Ubuntu Linux 20.04 LTS when upgrading to 22.04 LTS

Also make sure you confirm to restart services when asked. For example, do you want to keep your existing sshd config file?

Dealing with obsolete package on Ubuntu

You may be prompted to remove obsolete package as follows:

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

Press the d to view details about such packages and then either confirm it by pressing the y or deny it by pressing the N

System upgrade is complete

How to upgrade from Ubuntu 20.04 LTS to 22.04 LTS

After some time, you will get confirmation on the screen. A restart is required to finish the upgrade from 20.04 LTS to 22.04. Make sure you choose y, and then Ubuntu will restart:

Do not forget to delete ufw rule that you used to open tcp/1022. For example:
$ ufw delete allow 1022/tcp
Outputs:

Rule deleted
Rule deleted (v6)

Step 5 – 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
Outputs:

Linux 5.15.0-25-generic x86_64

Of course, use the lsb_release command too:
$ lsb_release -a
Sample outputs:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu Jammy Jellyfish (development branch)
Release:	22.04
Codename:	jammy

Step 6 – Enable 3rd party repos/mirros 

Now that Ubuntu 20.04 LTS to 22.04 LTS 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 my-apps.list
Outputs:

#deb [arch=amd64] https://dl.lan.cyberciti.biz/linux/deb/ stable main

To enable it again, I commented out the line by removing the #:

deb [arch=amd64] https://dl.lan.cyberciti.biz/linux/deb/ stable main

Then run the apt command:
$ sudo apt update
$ sudo apt upgrade

Finally, clean up unwanted and unused leftover packages:
$ sudo apt autoremove --purge

How to upgrade to 22.04 LTS from 20.04 LTS using a GUI method 

Make sure you apply all updates before typing the following commands. In other words:
$ sudo apt update
$ sudo apt upgrade
$ sudo reboot # <-- if a new kernel installed

Type the following command to start GUI update wizard:

If you do not get updates, try to pass the -d. If using the latest supported release, upgrade to the development release. For example:
$ sudo do-release-upgrade -f DistUpgradeViewGtk3 -d
OR
$ sudo update-manager -c -d

$ sudo do-release-upgrade -f DistUpgradeViewGtk3
OR use the following command:
$ sudo update-manager -c

Checking for a new Ubuntu release (click to enlarge)Then you will see the release note:

Click on the Upgrade buttonNow, wizard will prepare your system for upgrade:

Preparing to upgradeMake sure you confirm the upgrade procedure:

Do you want to start the upgrade?Then, the wizard will start downloading new files:

Upgrading Ubuntu to 22.04 LTS using GUI wizard utilityStarting in Ubuntu 22.04 LTS, all new versions of Firefox are only available via the snap package. So make sure you close all Firefox open tabs and windows and let the installer do the transition for you. You may get a system not responding message during such an update. Please do not cancel it and click on the wait button. Let the installer do the work:

Upgrade to the firefox snapYou may be prompted to replace or keep a customized config file message. For instance (either keep it or replace it as per your needs):

Replace or keep a customized file?We are now reaching the final upgrade stages, and you can either keep or remove obsolete packages. I decided to remove them as outdated packages do not receive security updates. But, you may wish to keep them so that system keeps working with older apps. So, be careful with this option (click the Details to see the package list):

Remove obsolete packages?

Restart the system to complete Ubuntu GUI upgradeAnd that is how you upgrade the system using GUI tools.

Default desktop screenshots

Here is my default Ubuntu 22.04 LTS desktop after upgrade with GNOME 42:
Default desktopAbout Ubuntu desktophtop

Video demo

This tutorial is also available in video format:

Summing up

In this quick tutorial, you learned about GUI and CLI methods for upgrading from Ubuntu 20.04 LTS to 22.04 LTS. Do check the following manual pages using the man command (or the –help and the official Ubuntu release notes too.
$ man do-release-upgrade
$ man apt
$ apt --help