Skip to content
Upgrading Ubuntu 16.04 LTS to 18.04 LTS

Upgrading Ubuntu 16.04 LTS to 18.04 LTS

February 11, 2020

Note

This post may be partially machine- or AI-translated. If there is any discrepancy, the Korean version takes precedence.

This is how to upgrade from Ubuntu 16.04 Xenial Xerus to 18.04 Bionic Beaver.
For upgrading from 18.04 to 20.04, see this post.

Problems such as boot failure can occur during the upgrade, so proceed only after understanding the risk.


Update packages

Update packages to the latest versions.

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

Reboot after the update completes.

$ sudo reboot now

Remove packages that are no longer needed.

$ sudo apt autoremove && sudo apt clean

Install update-manager

Install update-manager-core if it is not already installed.

$ sudo apt install update-manager-core

Change the update-manager configuration to upgrade to an LTS release.

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

Change it to Prompt=lts as shown below.

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for 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 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 this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=lts

Press Ctrl+X - Y - Enter to save.


Upgrade the Ubuntu release

Start the upgrade.

$ sudo do-release-upgrade
$ sudo do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]
Get:2 Upgrade tool [1,242 kB]
Fetched 1,243 kB in 0s (0 B/s)
authenticate 'bionic.tar.gz' against 'bionic.tar.gz.gpg'
extracting 'bionic.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]

A message appears saying that upgrading over SSH is not recommended.
This is because it is harder to recover if a problem occurs after the upgrade.
It also says an additional SSH daemon will run on port 1022 if you continue.
Enter y to confirm.


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.
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]

This is guidance for updating firewall settings.
It explains that if a problem occurs after the upgrade, you can connect over SSH on port 1022.
Press Enter to confirm.


To continue please press [ENTER]

Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://kr.archive.ubuntu.com/ubuntu xenial InRelease
Hit http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:1 http://kr.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Fetched 216 kB in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

Updating repository information
Get:1 http://kr.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]

.......

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done

Calculating the changes

Calculating the changes

Do you want to start the upgrade?

54 installed packages are no longer supported by Canonical. You can
still get support from the community.

40 packages are going to be removed. 402 new packages are going to be
installed. 1496 packages are going to be upgraded.

You have to download a total of 1,099 M. This download will take
about 2 minutes with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d]

Check the upgrade details, then enter y to continue.


 Continue [yN]  Details [d]y

Lock screen disabled

Your lock screen has been disabled and will remain disabled until you
reboot.

To continue please press [ENTER]
Inhibiting until Ctrl+C is pressed...

Because Ubuntu is running in a GNOME desktop environment, it says the lock screen will be disabled until reboot.
Press Enter to confirm.


Configuration file '/etc/update-manager/release-upgrades'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** release-upgrades (Y/I/N/O/D/Z) [default=N] ?

This appears because /etc/update-manager/release-upgrades has been updated.
Enter D to check the changes.

--- /etc/update-manager/release-upgrades        2020-02-11 16:55:07.071327392 +0900
+++ /etc/update-manager/release-upgrades.dpkg-new       2019-06-20 01:49:56.000000000 +0900
@@ -3,16 +3,14 @@
 [DEFAULT]
 # Default prompting behavior, valid options:
 #
-#  never  - Never check for a new release.
+#  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 release that immediately succeeds the currently-running
-#           release.
+#           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 this option should not be
-#           used if the currently-running release is not itself an LTS
-#           release, since in that case the upgrader won't be able to
-#           determine if a newer release is available.
+#           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
-
(END)

Only comments were updated, so enter q to close the comparison view.

*** release-upgrades (Y/I/N/O/D/Z) [default=N] ? y

Enter y to replace it with the updated version.


Searching for obsolete software
Reading state information... Done

Remove obsolete packages?

116 packages are going to be removed.

Removing the packages can take several hours.

 Continue [yN]  Details [d]

This asks whether to remove unused packages.
Enter y to remove them.


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]

This is the upgrade completion message.
Enter y to reboot.


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

You can confirm that the upgrade is complete.

Last updated on