Search Our Database

Upgrading Ubuntu from 20.04 to 22.04

Last updated on |

Introduction

This guide provides step-by-step instructions to upgrade your Ubuntu system from Ubuntu 20.04 LTS (Focal Fossa) to Ubuntu 22.04 LTS (Jammy Jellyfish), the latest Long Term Support (LTS) release from Canonical.

Ubuntu 22.04 LTS introduces a wide range of improvements over its predecessor, including a newer Linux kernel for enhanced hardware compatibility, GNOME 42 with a more responsive and modern desktop interface, updated security features, better power management, and overall performance enhancements. It also includes long-term support for newer technologies like Wayland and Snap packages, making it suitable for development, production, and enterprise environments.

As with all LTS versions, Ubuntu 22.04 will receive updates and security patches for five years, making it a reliable and stable choice for both desktop users and server administrators.

Whether you’re running a personal workstation, managing cloud infrastructure, or maintaining mission-critical systems, this guide will walk you through the upgrade process in a safe and structured way — ensuring minimal disruption and maximum reliability.

 

⚠️Note for Ubuntu 18.04 Users

If you’re using Ubuntu 18.04 LTS, you must first upgrade to Ubuntu 20.04 before continuing to 22.04.

👉 Follow this guide: Upgrading Ubuntu from 18.04 to 20.04

 

Prerequisites

  • You are currently running Ubuntu 20.04 LTS.
  • You are the system administrator with sudo or root access to the system
  • Your system has a stable internet connection for uninterrupted installation.
  • All pending system updates have been applied (apt update && apt upgrade).
  • It is highly recommended to create a full backup of your system to ensure seamless recovery in the event of an upgrade failure.
  • You have SSH or physical access to the machine (especially important for remote servers).

 

⚠️ Important: Before proceeding with the upgrade, make sure to take a full backup of your system. This includes all critical files, databases, and application data. If you’re using a cloud server or virtual machine, consider creating a full snapshot through your hosting provider. This ensures you can restore your system in case anything goes wrong during the upgrade process.This ensures that in the event of an upgrade failure, you can easily restore your system to its previous state with the latest data.

 

Step-by-step guide

Step 1: Update Current Packages

Open your terminal and run the following commands:

$ sudo apt update && sudo apt upgrade -y
$ sudo apt dist-upgrade -y

Then clean up unnecessary packages:

$ sudo apt autoremove --purge -y

 

 

Step 2: Reboot Your System

Once updates are applied, reboot the server:

$ sudo reboot

This will apply updates and restart your system.

 

 

Step 3: Allow Upgrade Port Access (For SSH Users)

During the upgrade process, Ubuntu will start a temporary SSH daemon on port 1022 as a fallback in case the main SSH connection is interrupted.

If your firewall is active (e.g., using UFW), allow traffic on port 1022:

$ sudo ufw allow 1022/tcp

This step is especially important if you’re upgrading via SSH

 

 

Step 4: Install the Update Manager Core

Ensure the update manager is installed:

$ sudo apt install update-manager-core

Edit the configuration to allow LTS upgrades:

$ sudo nano /etc/update-manager/release-upgrades

Make sure the following line is present:

Prompt=lts

 

 

Step 5: Begin the Upgrade

Now that your system is ready, begin the upgrade to Ubuntu 22.04 LTS using the do-release-upgrade tool.

If it’s not installed, run:

$ sudo apt install update-manager-core

Then start the upgrade process:

$ sudo do-release-upgrade

You’ll be guided through a series of prompts. Here’s what to expect:

✅ SSH Warning

If you’re connected via SSH, the tool will detect this and notify you that a new SSH daemon will be temporarily started on port 1022:

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]

and press ENTER to continue.


✅ sources.list Update

Next, the upgrade tool will check your repository sources and may display a message like the following:

Checking for installed snaps

Calculating snap size requirements

Updating repository information 

No valid mirror found 

While scanning your repository information no mirror entry for the upgrade was found. This can happen if you run an internal mirror or if the mirror information is out of date. 

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]

Type y and press ENTER to allow the system to update your repository entries from focal (Ubuntu 20.04) to jammy (Ubuntu 22.04).

This step is required to download and install the correct packages for Ubuntu 22.04.


✅ Upgrade Summary

Next, the upgrade tool will calculate and show a summary of:

  • Number of packages to install, upgrade, or remove

  • Packages no longer supported by Canonical

  • Total download size

  • Estimated time required

Example:

Building dependency tree 
Reading state information...Done 

Calculating the changes

Calculating the changes 

Do you want to start the upgrade? 


11 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. 483 packages are going to be upgraded. 

You have to download a total of 382 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]

Type y and press ENTER to proceed with the upgrade.

If you want to review the detailed list of package changes, you can type d instead — otherwise, continuing will start the download and installation of new packages for Ubuntu 22.04.


✅ Restarting Services Automatically

During the upgrade, you may see the following prompt when certain libraries or services (e.g., libpam, libc, libssl) are being upgraded:

Action: Select <Yes> and press ENTER.

This will allow the system to automatically restart services during the upgrade, which prevents additional interruptions or manual prompts later on.


✅ Configuration File Prompts

If the upgrade detects changes in configuration files (e.g. sshd_config ), you’ll be asked:

You can choose to:

  • Keep your existing version (recommended if you’ve made changes)

  • Install the maintainer’s version

Select your option and press ENTER.


✅ Remove Obsolete Packages

At the end, you’ll be prompted to remove packages no longer needed:

Check GRUB_DISABLE_OS_PROBER documentation entry. 
done 
Reading package lists... Done 
Building dependency tree 
Reading state information... Done 

Searching for obsolete software 
Reading state information... Done 

Remove obsolete packages? 


36 packages are going to be removed. 

Continue [yN] Details [d]

Type y and press ENTER

Once the upgrade process is complete, you’ll see a message like this:

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

When the upgrade process completes, reboot the system:

$ sudo reboot

 

 

Step 6: Confirm Your Ubuntu Version

After the system reboots, verify the new version:

$ lsb_release -a

You should see output like:

 

 

Step 7: Close Port 1022

If you previously allowed port 1022 for SSH fallback, you can now close it:

$ sudo ufw delete allow 1022/tcp

This ensures your firewall rules are back to normal after the upgrade is complete.

 

 

🔐 Post-Upgrade Security Check (Firewall & Ports)

During the upgrade process, all third-party repositories will be automatically disabled to prevent conflicts. If your server relies on external sources like DockerNode.js, PHP PPAs, or other vendor-specific repositories, take note of them beforehand.

After the upgrade, you will need to re-enable them manually:

Re-enabling Third-Party Repositories

Repository files are located in:

/etc/apt/sources.list.d/

 

To list the files:

ls -l /etc/apt/sources.list.d/

 

Open each file and uncomment the repository lines (remove the # symbol). Then update the package list:

sudo apt update

 

Once done, you can clean up unused packages:

sudo apt autoremove --purge -y

 

 

After upgrading, verify your firewall settings. In some cases, services like ufw or firewalld may be disabled or reset.

Check if UFW is enabled:

sudo ufw status

 

Or if using firewalld:

sudo firewall-cmd --list-all

 

Ensure that essential ports are allowed:

  • SSH: 22
  • HTTP: 80
  • HTTPS: 443

If no firewall is active, consider setting one up to protect your server.

 

 

 

Conclusion

Well done! You’ve successfully upgraded to Ubuntu 22.04 LTS. This version offers long-term security updates, better performance, and improved support for modern software and hardware.

After upgrading, remember to:

  • Check that all your services (e.g., Apache, NGINX, PostgreSQL) are running correctly
  • Ensure any third-party applications are compatible with the new version
  • Explore new features and configuration options introduced in 22.04

For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.