Fixing a failed upgrade to Ubuntu 20.04 LTS in recovery mode

My main laptop has been running Ubuntu 19.10 (Eoan Ermine). I deliberately postponed the upgrade to Ubuntu 20.04 LTS (Focal Fossa) because I had a very busy period writing a book and studying for evening classes. I just couldn't afford the time to fix potential upgrade issues, my laptop should "just work".

But now time is running out: Ubuntu 19.10 will reach end of life status on July 17th, 2020. Because I'm having a 'vacation' week now, I could spend some time if the upgrade fails.

And failing it did...

I'm not sure what went wrong, but after all packages had been downloaded and when the upgrade process was in the middle of applying the package upgrades, the screen became grey and showed the message "Something has gone wrong. Please logout and try again." I had to restart Ubuntu and it even didn't reach the login screen.

I first tried removing quiet splash from the boot entry, but that didn't make me any wiser. So off to recovery mode then:

  • Hold the Shift key while booting the PC.

  • In the GRUB boot menu that appears, choose the advanced options and then recovery mode.

  • In the recovery menu that appears, enable networking first and then choose the option to open a root shell.

Because the installation has been aborted, I tried fixing a broken install:

# apt --fix-broken install

To my surprise this "just worked", so it seems the system wasn't broken that badly.

To be sure I didn't miss any package configuration, I configured all unpacked but not yet configured packages:

# dpkg --configure -a

This returned silently, so no issues there.

Then I continued the upgrade:

# apt upgrade

This all went smoothly. So after the upgrade succeeded, I had Ubuntu 20.04 on my system:

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

I rebooted:

# reboot

And then I could login again and was welcomed by this stylish desktop background:

/images/ubuntu-20.04-desktop-with-lsb-release.png