2 Ways to Upgrade Ubuntu 20.04 To Ubuntu 22.04 (Graphical & Terminal)
Ubuntu 22.04 Jammy Jellyfish will be released on April 21, 2022. This tutorial is going to show you 2 ways to upgrade from Ubuntu 20.04 to Ubuntu 22.04: using the graphical update manager and using the command line. Normally you use the graphical update manager to upgrade Ubuntu desktop and use the command line to upgrade Ubuntu server, but the command-line method works for desktops too.
Ubuntu 22.04 New Features
- Wayland becomes the default display server for most users.
- Linux Kernel 5.15
- GNOME 42
- PHP8.1, Ruby 3.0, Python 3.10, OpenJDK 18.
nftables
is now the default firewall backend, replacingiptables.
- Firefox is now only available as a Snap package.
- RDP replaces the legacy VNC as the default remote desktop protocol.
- The
scp
command line utility now supports the secure SFTP transfer mode. - BIND 9.18: supports DNS over TLS and DNS over HTTPS, zone transfers over TLS.
- and many more.
Note: Before doing the upgrade, you can use the systemback program to create a bootable ISO image from your current OS. If the upgrade fails, you can easily restore your OS with the bootable ISO. Everything on your OS including software and files will be intact. If you are using a laptop, please connect your power source.
Upgrade Ubuntu 20.04 to Ubuntu 22.04 with the Graphical Update Manager
First of all, open software updater
(aka update manager) from your application menu. It will update software package information. If there’s updates available, click the Install Now
button and enter your password to install updates.
If a new version of Linux kernel is installed, then the update manager will tell you to restart your computer. Click Restart Now
.
Then open Software & Updates
from your application menu.
Select the Updates
tab. At the bottom of the window, set notification to For long-term support versions
.You will be asked to enter your password for the change to take effect.
Close the Software & Updates
window. Then open up a terminal window and issue the following command.
update-manager -d
After checking for updates, the update manager will tell you that Ubuntu 22.04 is now available. Click the Upgrade button.
Next, enter your password. The release notes window appears. Click Upgrade.
The distribution upgrade window will open up. If you are notified that some third-party sources are disabled, accept it. You can re-enable them after the upgrade is finished.
In a few moments, you will be asked if you want to start the upgrade. Click the Start Upgrade
button.
If you have made changes to some system configuration files before, then you might be asked if you want to replace the customized configuration file. I recommend choosing Keep
to keep your customized configuration file. The updated version will be available at the same directory. You can check it out later.
Wait for the upgrade process to finish. The update manager may ask you if you want to restart services during packages upgrade without asking. Tick it on and click Next
button.
After new versions of packages are installed, the update manager may ask you if you want to remove obsolete packages. I always select Remove
.
Obsolete packages are software packages whose name can’t be found in the software repository of the new Ubuntu release. The cause of obsolete packages are the following:
- The upstream developer stops maintaining this package and there is no other person willing to take over. So the Ubuntu package maintainer decides to drop this package from the Ubuntu repository.
- The package becomes an orphan package, which means there’s no other package that depends on it and there are very few users of this package. So the Ubuntu package maintainer decides to drop this package from the Ubuntu repository.
- The package has a new name in the software repository of the new Ubuntu release.
After obsolete packages are removed from your system. Restart your computer and check your Ubuntu version with the following command.
lsb_release -a
Output:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu Jammy Jellyfish Release: 22.04 Codename: jammy
Upgrade Ubuntu 20.04 to Ubuntu 22.04 From Command Line
You can use the command line to upgrade Ubuntu desktop or a headless server. Speaking of servers, it is recommended that you upgrade Ubuntu on a test server before doing it on a production server. Some server software such as iRedMail (a mail server software suite) may not support Ubuntu 22.04 yet. In that case, it is advisable to wait some time for the software to support Ubuntu 22.04.
Keep Your SSH Session Alive
If you use SSH to log into your Ubuntu server, it’s a good idea to keep your OpenSSH session alive by using the screen
utility. Install screen on the Ubuntu server:
sudo apt install screen
Then start screen:
screen
Upon the first launch, you will see an introduction text, simply press Enter
to end. Then you will be able to run commands as usual.
It’s also recommended to add the following line at the bottom of the /etc/ssh/sshd_config
file on your server to keep your SSH session alive.
ClientAliveInterval 60
Save and close the file. Then restart SSH daemon.
sudo systemctl restart ssh
Upgrade to Ubuntu 22.04 From Command Line
To upgrade to Ubuntu 22.04, first run the following command to upgrade existing software. (Please note that if a new Linux kernel is installed while running the following command, you need to reboot system in order to continue the upgrade process.)
sudo apt update && sudo apt dist-upgrade
Then make sure you have the update-manager-core
package installed.
sudo apt install update-manager-core
Open the /etc/update-manager/release-upgrades
file with a command-line text editor like Nano.
sudo nano /etc/update-manager/release-upgrades
Make sure the value of prompt is set to lts
.
Save and close the file. To save a file in Nano text editor, press Ctrl+O
, then press Enter to confirm. To exit, press Ctrl+X
.
After that, run the following command to begin the upgrade process.
do-release-upgrade -d
Then follow the on-screen instruction to upgrade to Ubuntu 22.04. Basically, you need to press y
to answer the questions.
If you are upgrading a server, you will probably see messages like below. I recommend choosing N
to keep your current version. The updated version will be available at the same directory. You can check it out later.
Once the upgrade is finished, reboot your Ubuntu desktop or server. To check your Ubuntu version, run:
lsb_release -a
Output:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu Jammy Jellyfish Release: 22.04 Codename: jammy
Please install all available updates for your release before upgrading
If you see the following message when trying to upgrade, then you need to update all packages (sudo apt update;sudo apt upgrade -y
) then restart the OS and try to upgrade again.
Please install all available updates for your release before upgrading.
Sometimes your system may have some package kept on hold, which can be shown with:
sudo apt-mark showhold
You need to unhold the package.
sudo apt-mark unhold package-name
Then run
sudo apt upgrade
Sometimes, sudo apt update
tells you that a package can be upgraded, but sudo apt upgrade
won’t upgrade the package, then you can run the following command to list the package.
apt list --upgradable
Now you can upgrade the package.
sudo apt upgrade pacakge-name
If this is a broken package that can not be upgraded, then remove it.
sudo apt remove package-name
How to Re-Enable Third-Party Repositories
Third-party repositories are defined in the .list
files under /etc/apt/sources.list.d/
directory. First, re-enable third-party repositories with the following command, which will remove the #
character in lines that begin with deb
.
sudo sed -i '/deb/s/^#//g' /etc/apt/sources.list.d/*.list
Then change all instances of focal
to jammy
.
sudo sed -i 's/focal/jammy/g' /etc/apt/sources.list.d/*.list
Update package repository index.
sudo apt update
Some third-party repositories don’t have an entry for Ubuntu 22.04, so you will likely see errors like:
E: The repository 'http://linux.dropbox.com/ubuntu focal Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
You will need to edit these repository files one by one and disable them. For example, I edit the Dropbox repository file.
sudo nano /etc/apt/sources.list.d/dropbox.list
Disable this repository by adding the #
character at the beginning of the line.
# deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu jammy main # disabled on upgrade to jammy
Save and close the file. You need to wait for those repositories to add support for Ubuntu 22.04.
Some software packages in third-party repositories might be included in 22.04. For example, Ubuntu 22.04 repository contains the nextcloud-desktop
package, so I don’t need the Nextcloud PPA anymore. I can delete the Nextcloud PPA.
sudo rm /etc/apt/sources.list.d/nextcloud-client.list*
How to Install the Yaru Mixed Theme
Ubuntu 22.04 ships with an all-white or all-dark Yaru theme. If you want to get the mixed Yaru theme back, then remove the Ubuntu 22.04 version of yaru-theme-gtk
.
sudo apt remove yaru-theme-gtk
Then download the Ubuntu 20.04 version of yaru-theme-gtk
.
wget http://archive.ubuntu.com/ubuntu/pool/main/y/yaru-theme/yaru-theme-gtk_20.04.11.1_all.deb
Install this package.
sudo apt install ./yaru-theme-gtk_20.04.11.1_all.deb
Next, go to Settings
-> Themes
and choose the light theme.
To prevent Ubuntu from updating the yaru-theme-gtk
package, run the following command.
sudo apt-mark hold yaru-theme-gtk
Installing Nvidia Driver
If your desktop environment becomes sluggish after the upgrade, then you might need to install the Nvidia graphics driver.
Wrapping Up
That’s it! I hope this tutorial helped you upgrade to Ubuntu 22.04 from Ubuntu 20.04. As always, if you found this post useful, then subscribe to our free newsletter to get new tutorials. You might also want to read:
Please only upgrade to the new LTS version on your physical computer after the official release date. Upgrading to a beta release could result in a broken system.
Brilliant. As usual
Nicely done!
Thanks, very helpful. I’ve always done the GUI upgrade, but I do like the feeling of more control that CLI gives me. Thanks to your article, I can see clearly what I need to do.
No rush, of course. I use Ubuntu-Mate. The LTS version is supported for 3 years, so I’m in no rush, nothing in the upgrade looks really essential. I’ll probably upgrade one machine at a time, and make note of any problems.
Thank you
Fantastic tutorial¡
Many thanks
Thank you
Hi, since I upgraded from 20.04 to 22.04, Plexmediaserver and Teamviewer repo are not anymore supported.
I disabled both repos as I get an error when update.
I’m really surprised and not so conviced that these two repos still be not compatible with Ubuntu 22.04.
Do I have to add new repo or I must wait until already installed repo are compatible?
Can I delete unused repo?
Thanks