Upgrading from Ubuntu 16.04 to Ubuntu 20.04 - theunissenlab/lab-documentation GitHub Wiki

As of November 2020, all of our Ubuntu servers and workstations (zebra, finch, corvus, aquila, tucana, strfinator, goats) are running Ubuntu 16.04.

Unfortunately, 16.04 is reaching is end of life (EOL) in April 2021 (rip). It will no longer be supported and will not receive security updates and bug fixes. This means that we should move toward upgrading these systems to the latest version of Ubuntu, 20.04, which has a EOL of 2025.

I am going to upgrade goats as a test, from Ubuntu 16.04.6 LTS to the latest Ubuntu 20.04, and take notes on this here.

Since you cannot upgrade directly from 16.04, I will upgrade from 16.04 to 18.04 following these instructions, and then upgrade from 18.04 to 20.04 following these instructions, from the command line.

Preparing for upgrade to 18.04

sudo apt update
sudo apt upgrade          # This can take quite a while if you haven't updated in a while
sudo apt dist-upgrade     # Changes software dependencies with new versions of packages
sudo apt-get autoremove   # removes dependencies of uninstalled applications

Upgrading to 18.04

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

Reboot.

Upgrading to 20.04

Before you go forward with the next do-release-upgrade, you will need to install all available updates for 18.04

sudo apt update
sudo apt upgrade

Reboot.

sudo do-release-upgrade

Note: I had several issues on corvus, getting a message "Can't upgrade Ubuntu 18.04 to 20.04 because of Please install all available update for your release before upgrading". This is supposed to be solved by the earlier update and upgrade steps, but there was some problematic packages that couldn't be upgraded. Other computers may not have these. I followed the instructions here (which I don't know if were necessary) and removed the packages r-cran-boot, r-cran-codetools and r-cran-spatial. No idea what these were.

Notes while upgrading goats

1 sudo apt update

Went smoothly

2 sudo apt upgrade

This ran for quite a while and ended with an error:

...
Errors were encountered while processing:
 ubuntu-make
E: Sub-process /usr/bin/dpkg returned an error code (1)

And when rerunning the sudo apt upgrade command the cause was clearer (register-python-argcomplete3: not found):

Setting up ubuntu-make (18.05~xenial1) ...
/var/lib/dpkg/info/ubuntu-make.postinst: 6: /var/lib/dpkg/info/ubuntu-make.postinst: register-python-argcomplete3: not found
dpkg: error processing package ubuntu-make (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 ubuntu-make
E: Sub-process /usr/bin/dpkg returned an error code (1)

After some googling of what "ubuntu-make.postinst: register-python-argcomplete3" has to do with anything, it seems like there might be a version of python-argcomplete3 installed that did not come from the original ubuntu install. I found some advice to find the ppa pointing to the wrong version and then sudo apt install python3-argcomplete/xenial. To list your ppas (where apt looks to install stuff)

grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/

Part of my output was the following. neurodebian and mountainlab seemed like the most likely candidates.

/etc/apt/sources.list.d/magland-ubuntu-mountainlab-xenial.list:deb http://ppa.launchpad.net/magland/mountainlab/ubuntu xenial main
/etc/apt/sources.list.d/google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/ubuntu-desktop-ubuntu-ubuntu-make-xenial.list:deb http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu xenial main
/etc/apt/sources.list.d/neurodebian.sources.list:deb http://neurodeb.pirsquared.org data main contrib non-free
/etc/apt/sources.list.d/neurodebian.sources.list:deb http://neurodeb.pirsquared.org xenial main contrib non-free

Next, running

apt-cache policy python3-argcomplete

showed me that I have a version of python3-argcomplete (1.0.0-1) coming from the neurodebian ppa that is superceding ubuntus correct version (0.8.1).

python3-argcomplete:
  Installed: 1.0.0-1~nd+1+nd16.04+1
  Candidate: 1.0.0-1~nd+1+nd16.04+1
  Version table:
 *** 1.0.0-1~nd+1+nd16.04+1 500
        500 http://neurodeb.pirsquared.org xenial/main amd64 Packages
        500 http://neurodeb.pirsquared.org xenial/main i386 Packages
        100 /var/lib/dpkg/status
     0.8.1-1ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe i386 Packages

I chose to simply remove the ppa file from /etc/apt/sources.list.d with

sudo rm -i /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt install python3-argcomplete/xenial
sudo apt autoremove

This worked and now the correct version of python3-argcomplete is installed. Note that if you need to keep the neurodebian ppa or whatever is causing you problems, there is a way to have apt prioritize the right one. But I didn't want to figure that out.

Then sudo apt upgrade should be done.

3 sudo apt dist-upgrade

4 sudo apt-get autoremove

5 sudo apt install update-manager-core

Was already installed

6 sudo do-release-upgrade

Before I could run this, I had to reboot goats. The upgrader recommends to not do the upgrade over ssh since its harder to recover if something goes wrong. So I chickened out and ran the update in person.

The download takes about 5 minutes. When the download finishes there's no turning back and you need to wait for the whole update process to complete. It took about an hour for me on goats.

It also gave me a prompt to remove obsolete packages and that it could take several hours to do so. They were right - this took quite a long time. But I think its good to do so or else packages that are no longer needed in newer versions of Ubuntu will be taking up disk space later on.

When this was finished a reboot was in order.

Unfortunately, after rebooting I got a login window with the main ubuntu user and a "slurm" user. I think the slurm thing is fine, but when trying to log in as myself I reached a login loop. But after Ctrl-Alt-F3 I could log in as myself and saw that the remote drives were successfully mounted. So its seems most likely to be a display manager compatibility issue. Not sure if I should try to fix this or just keep the upgrade going to 20.04...

6 sudo apt update & sudo apt upgrade

I decided to move onward without fixing the display manger issues. The apt update and apt upgrade commands went on without a hitch (took about 5 minutes for upgrade).

Before you can do the next step, you'll probably need to reboot.

7 sudo do-release-upgrade

Finally, you can run the update. There are couple prompts, including confirming that "some third party entries in your sources.list were disabled" as well as another prompt confirming the download (2GB) which should take about 2 minutes on the lab network, and then the upgrade process which will take a much longer time. This takes at most 4 hours but potentially much less (I left the computer to do a surgery).

There will be one more prompt once the upgrade is completed to remove obsolete packages. It warns you it may take a while (like last time). This actually went quite fast, probably because they were mostly removed in the first upgrade.