Upgrade from Ubuntu 20.04 LTS to 22.04 LTS Server
Ubuntu 22.04 is a Long-Term Support (LTS) release and will receive ongoing app updates and critical security fixes for the next five years. New Linux kernel releases and graphics driver updates are also rolled out as software updates every six months or so.
Ubuntu 22.04 brings a ton of fascinating features for developers and system administrators, such as:
OpenSSL 3.0
Ubuntu 22.04 has transitioned to OpenSSL 3.0 which is a major release that brings new cryptographic algorithms to elevate SSL connection security.
Programming Tool
It's also shipped with renewed software development libraries such as:
- Python 3.10.4
- Golang 1.18,
- PHP 8.1,
- Ruby 3.0,
- OpenJDK 18,
- Perl 5.34,
- Rust 1.58,
- glibc 2.35,
- Django 3.2.12.
New Kernel
Ubuntu 22.04 uses Linux Kernel version 5.15 which is one of the newest kernel versions available that has already been tested enough to be considered a stable system by Canonical. Linux Kernel 5.15, among other things, comes with NTFS3 file system driver, has an in-kernel space SMB server, and supports new hardware, including AMD CPUs and GPUs, Apple's M1 chip, and Intel Alder Lake CPUs.
Network Time Security
Ubuntu 22.04 now supports Network Time Security (NTS) which provides cryptographic security for the client-server mode of the Network Time Protocol (NTP). NTS gives users an authentication mechanism to obtain time and make applications that rely on time more secure.
Upgrade Procedure
Backup Your Data
The importance of backup Cannot be STRESSED enough – backups, backups, backups! Do not proceed further without backups.
Update Currently Installed Packages
It is recommended to update all your currently installed packages to their latest versions.
Some 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 update
$ sudo apt upgrade
Reboot the system if required.
Upgrade your system
$ sudo apt full-upgrade
apt full-upgrade
may remove some currently installed packages that prevent upgrading the system as a whole.
Remove old kernels and all automatically installed dependencies that are no longer needed:
$ sudo apt --purge autoremove
Upgrade to Ubuntu 22.04 LTS (Jammy Jellyfish)
Upgrading to the latest Ubuntu version is a pretty straightforward process.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
Also, make sure the 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 running a firewall on your machine, you will need to open the port 1022
temporarily to make recovery in case of failure. If anything goes wrong with the running ssh you can still connect to the additional one.
$ sudo ufw allow 1022
$ sudo iptables -I INPUT -p tcp --dport 1022 -j ACCEPT
... now let's start the upgrade:
$ sudo do-release-upgrade
or
$ sudo do-release-upgrade -d
Output
###
##
#
Calculating the changes
No candidate ver:
linux-image-5.4.0-107-generic
No candidate ver:
linux-image-5.4.0-109-generic
No candidate ver:
linux-modules-5.4.0-107-generic
No candidate ver:
linux-modules-5.4.0-109-generic
No candidate ver:
linux-modules-extra-5.4.0-107-generic
No candidate ver:
linux-modules-extra-5.4.0-109-generic
##
#
#
Here we will be using the -d
flag. This is done because upgrading to the latest LTS is not directly available till July of the year. In another word, the -d
flag forces the command to upgrade to the latest LTS development release.
During the upgrade process, you will be asked various questions, like whether you want to keep an existing configuration file or to install the package maintainer's version.
Read the questions carefully before making any decision.
When the upgrade process is complete and assuming all went well, you'll be asked to reboot your machine.
Type y
to continue:
Output
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
Check your Ubuntu version:
$ lsb_release -a
Ouput
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
Check the Kernel version:
$ uname -mrs
Output
Linux 5.15.0-1008 aarch64
Bonus:
How do I reattach to Ubuntu Server's 'do-release-upgrade' process?
Suppose you accidentally lose connection during the do-release-upgrade
process. Hopefully, the do-release-upgrade
starts a backup SSH session on port 1022 and a backup screen session. If you do not have screen
installed this will NOT be available.
You can get the screen session by running:
$ sudo screen -list
There is a screen on:
3466.ubuntu-release-upgrade-screen-window (30/05/2022 12:21:32 AM) (Detached)
1 Socket in /var/run/screen/S-root.
... then to reattach do:
$ sudo screen -d -r root/3466.ubuntu-release-upgrade-screen-window
You should be back to where you lost connection.
That's it. Enjoy your new Ubuntu 22.04 Server installation.