Upgrading Ubuntu Server 16.04 LTS to 18.04 LTS

Here's a diary of my experience updating Ubuntu Server, on command line, with no desktop environment.

Starting the upgrade

This is the easy part...

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install update-manager-core
sudo do-release-upgrade


Considerations when upgrading through SSH

Since I'm upgrading through SSH, I got this message:

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


Before pressing enter, I opened a new shell and entered the recommended command in order to pass the new SSH port through iptables:

sudo iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

I checked that the port is open by opening an SSH shell to the new port.


Warning about third party repositories

Updating repository information

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]

This is fine. I can add third party repos later when needed.


Error: Invalid package information

Invalid package information

After updating your package information, the essential package 'ubuntu-minimal' could not be located. This may be because you have no official mirrors listed in your software sources, or because of excessive load on the mirror you are using. See /etc/apt/sources.list for the current list of configured software sources. In the case of an overloaded mirror, you may want to try the upgrade again later.

I had to add the following lines in the end of /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu/ xenial main universe multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-security main universe multiverse

Then I ran do-release-upgrade again.


The upgrade starts

Do you want to start the upgrade?

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

5 packages are going to be removed. 205 new packages are going to be installed. 690 packages are going to be upgraded.

You have to download a total of 601 M. This download will take about 1 hour 16 minutes with a 1Mbit DSL connection and about 23 hours with a 56k modem.

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

 Continue [yN]  Details [d]


Nowadays most will get the upgrade faster than these estimates, I quess. In my case the download finished in 6 seconds.


Warning about old Linux kernel versions

glibc (2.26-5) unstable; urgency=medium

Starting with version 2.26-1, the glibc requires a 3.2 or later Linux kernel. If you use an older kernel, please upgrade it *before* installing this glibc version. Failing to do so will end-up with the following failure:

Preparing to unpack .../libc6_2.26-5_amd64.deb ... ERROR: This version of the GNU libc requires kernel version 3.2 or later.  Please upgrade your kernel before installing glibc.

The decision to not support older kernels is a GNU libc upstream decision.

Note: This obviously does not apply to non-Linux kernels.

 -- Aurelien Jarno <aurel32@debian.org>  Tue, 23 Jan 2018 22:03:12 +0100



It's unlikely that you are running a linux kernel that old. This message can be ignored.

GRUB complains about changed hard drive ID

The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason. It is important to make sure that the installed GRUB core image stays in sync with GRUB modules and grub.cfg. Please check again to make sure that GRUB is written to the appropriate boot devices.

If you're unsure which drive is designated as boot drive by your BIOS, it is often a good idea to install GRUB to all of them.

Note: it is possible to install GRUB to partition boot records as well, and some appropriate partitions are offered here. However, this forces GRUB to use the blocklist mechanism, which makes it less reliable, and therefore is not recommended.

 
You should choose your main hard drive, often it is /dev/sda. Do this with up/down arrows and select with space bar.
Don't choose partitions (they have numbers, like /dev/sda1), since installing GRUB is not recommended.


Warning about /etc/apt/listchanges.conf

The install process complained that I've changed this file, although I had not. I installed the package maintainer's version. There were very few changes.


Warning about apache2 configuration file

Configuration file '/etc/apache2/apache2.conf'
 ==> 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.
*** apache2.conf (Y/I/N/O/D/Z) [default=N] ?


I chose to keep the current version of the configuration. Usually you want to do this.

The distribution version was automatically saved to
/etc/apache2/apache2.conf.dpkg-dist

The line about Mutex file had been commented in the new apache2 version:

#Mutex file:${APACHE_LOCK_DIR} default

Also, a runtime directory directive had been added:

#
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}

After the upgrade, I decided to manually add the DefaultRuntimeDir to my configuration, but left the Mutex directive uncommented.

Warning about sshd configuration file

Configuring openssh-server

sshd_config: A new version (/tmp/fileXXXXXX) of configuration file /etc/ssh/sshd_config is available, but the version installed currently has been locally modified.

What do you want to do about modified configuration file sshd_config?

I chose to keep my version of the sshd configuration. The new version was saved automatically to
/etc/ssh/sshd_config.ucf-dist

I went through the new version manually and changed some rows in my custom config.

Warning about backup-manager configuration file

Configuring backup-manager

A new version (/tmp/tmp.XXXXXX) of configuration file /etc/backup-manager.conf is available, but the version installed currently has been locally modified.

What do you want to do about modified configuration file backup-manager.conf?


Here I kept my version of the config as well. The package version was saved automatically to:
/etc/backup-manager.conf.ucf-dist


Finally, it's reboot time

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



Be patient if updating through SSH

After a while, I tried to login through SSH with my username and password. The sshd server just replied "Access denied". It looks scary but there should be no need to worry. Just wait a while longer and try again.


After the upgrade

I went through the apache2, sshd and backup-manager configuration files, as described above.


The case of the disappearing python modules

I was using a couple of python libraries, but they were gone. I had to install them again:

pip3 install psutil
pip3 install pillow
...

Comments

Popular posts from this blog

How to install and play Curse of Monkey Island on Android

How to get rid of coil whine just by tweaking BIOS

How to fix the weird audio bug in Kingdom Come: Deliverance

How to find the ScummVM game folder on Android

How to fix the Anno 1404 out of memory error

Create a sleep timer for Youtube, Twitch, Netflix etc. on Windows 10