Upgrade Ubuntu 18 LTS to the latest Ubuntu 20 LTS (Long Term Support) release.

Operating system version before release upgrade.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:  Ubuntu 18.04.4 LTS
Release:  18.04
Codename: bionic

Ensure that default prompting behavior is set to the LTS release.

$ cat /etc/update-manager/release-upgrades
# Default behavior for the release upgrade.
[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for, or allow upgrading to, a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the supported release that immediately succeeds the
#           currently-running release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that if this option is used and
#           the currently-running release is not itself an LTS release the
#           upgrader will assume prompt was meant to be normal.
Prompt=lts

Install all available updates.

$ sudo apt update
$ sudo apt upgrade

It is extremely important to upgrade the operating system, release upgrade will not start without every available update installed.

$ do-release-upgrade -d
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

Reboot the operating system.

$ sudo reboot

This step is required, you cannot skip it.

$ sudo do-release-upgrade -d
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading.

Check for new Ubuntu LTS release, there is none but dot worry.

$ sudo do-release-upgrade -c
Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release
set Prompt=normal in /etc/update-manager/release-upgrades.

Check for new Ubuntu LTS development release.

$ sudo do-release-upgrade -dc
Checking for a new Ubuntu release
New release '20.04 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Start the release upgrade process.

$ sudo do-release-upgrade -d
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,342 kB]
Fetched 1,343 kB in 0s (0 B/s)
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg'
extracting 'focal.tar.gz'
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
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.
To continue please press [ENTER]
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://archive.ubuntu.com/ubuntu bionic InRelease
Hit http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit http://security.ubuntu.com/ubuntu bionic-security InRelease
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Updating repository information
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]
[...]
Get:269 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-urllib3 all 1.25.8-2 [88.1 kB]
Get:270 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-distro all 1.4.0-1 [14.6 kB]
Get:271 http://archive.ubuntu.com/ubuntu focal/main amd64 ssh-import-id all 5.10-0ubuntu1 [10.0 kB]
Fetched 79.1 MB in 6s (10.1 MB/s)
Upgrading
Fetched 0 B in 0s (0 B/s)
  MarkInstall libc6:amd64 < 2.27-3ubuntu1 -> 2.31-0ubuntu9 @ii umU Ib > FU=1
  Installing libgcc-s1 as Depends of libc6
    MarkInstall libgcc-s1:amd64 < none -> 10-20200411-0ubuntu1 @un uN Ib > FU=0
    Installing gcc-10-base as Depends of libgcc-s1
      MarkInstall gcc-10-base:amd64 < none -> 10-20200411-0ubuntu1 @un uN > FU=0
  Installing libcrypt1 as Depends of libc6
    MarkInstall libcrypt1:amd64 < none -> 1:4.4.10-10ubuntu4 @un uN > FU=0
    MarkInstall locales:amd64 < 2.27-3ubuntu1 -> 2.31-0ubuntu9 @ii umU Ib > FU=0
    Installing libc-bin as Depends of locales
      MarkInstall libc-bin:amd64 < 2.27-3ubuntu1 -> 2.31-0ubuntu9 @ii umU > FU=0
  new important dependency: libidn2-0:amd64
  Installing libidn2-0 as Recommends of libc6
    MarkInstall libidn2-0:amd64 < 2.0.4-1.1ubuntu0.2 -> 2.2.0-2 @ii umU > FU=0
[...]
Searching for obsolete software
Reading state information... Done
Remove obsolete packages?
18 packages are going to be removed.
 Continue [yN]  Details [d] y
Fetched 0 B in 0s (0 B/s)
(Reading database ... 19833 files and directories currently installed.)
Removing libdns-export1100 (1:9.11.3+dfsg-1ubuntu1.12) ...
Removing libpython3.6:amd64 (3.6.9-1~18.04ubuntu1) ...
Removing python3.6 (3.6.9-1~18.04ubuntu1) ...
Removing libpython3.6-stdlib:amd64 (3.6.9-1~18.04ubuntu1) ...
[...]
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
Connection to 172.16.51.18 closed by remote host.
Connection to 172.16.51.18 closed.

Operating system version after release upgrade.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal

Additional notes

Use additional SSH daemon on port 1022 when working remotely.

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
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.
To continue please press [ENTER]

Remember about third-party repositories.

Third party sources disabled
Some third party entries in your sources.list were disabled. You can
re-enable them after the upgrade with the 'software-properties' tool
or your package manager.
To continue please press [ENTER]

The do-release-upgrade utility is provided by the ubuntu-release-upgrader-core package.

Upgrade only fresh Ubuntu 18 LTS as there are some package changes. Keep an eye on cloud-init as preserve_hostname will change to false and systemd-resolved to keep DNS queries from failing.