Here I’ll explain how to upgrade your Ubuntu system. Remember that this might cause issues in your system if something fails in the middle so I’d strongly recommend to do a backup before. You could use the pre-installed Ubuntu tool for doing backups.

Check your current version

First check if your current version it’s 20.04 with command uname -r:

5.4.0-109-generic

Also, with command cat /etc/lsb-release:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

Upgrade your system to the very last 20.04LTS version

Execute:

sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

Remove not needed packages:

sudo apt autoremove

Reboot the system:

sudo reboot

Upgrade to 22.04LTS version

First install update-manager-core package to do it:

sudo apt install update-manager-core

Check the available updates first withouth applaying them:

sudo do-release-upgrade --check-dist-upgrade-only

To continue with the upgrade execute the command with -d flag:

sudo do-release-upgrade -d --allow-third-party