Ubuntu Upgrade: 16 to 18

Introduction

My upgrade from Ubuntu 16 to 18 was anything but smooth. Here’s the story, in case others find it useful or I need to refer back to what happened.

Why Upgrade?

If it ain’t broke, don’t fix it. My desktop had been running Ubuntu 16 for years and was happy. Since one of the things I use it for is listening to music, I wanted the later version of Pulseaudio that can play music at its native bit rate. Ubuntu 16 resamples everything to one of 2 system bit rates.

The Upgrade

The upgrade itself went smoothly. In short, these commands ran just fine:

sudo apt updatesudo apt dist-upgradesudo do-release-upgrade

After that, all hell broke loose.

Problem 1: No Boot

The system failed in the Grub boot loader and dropped the Grub rescue prompt:

Error: Symbol 'grub_calloc' not found. 
Entering rescue mode...
grub_rescue>

To fix this, I used Ubuntu Boot Repair. I flashed its ISO to a USB stick, booted to that stick, then ran the standard boot repair, which reinstalls Grub on the PC.

Problem fixed: the computer now boots!

Problem 2: Laggy Desktop

The mouse pointer lagged by a second or two, reminding me of using a mouse on my old 4.77 MHz IBM XT years ago. Turns out the upgrade hosed my video driver, making it not entirely the Nvidia driver, not entirely the open source driver, but some kind of zombie hybrid of the two.

I uninstalled the Nvidia driver and rebooted. But I couldn’t do that, because apt-get was broken. I had to fix that first.

Problem 3: Apt-Check

After every Ubuntu install or upgrade I always re-enable whatever repos were disabled for the upgrade, then update all the software so it can install new versions. This problem manifested as an error message whenever I ran “apt”:

libdvd_pkg: 'apt-get check' failed. You may have broken packages. Aborting...

This turned out to be caused by the libdvd package not completing its installation steps. To fix this, we can complete them manually:

sudo dkpg-reconfigure libdvd-pkg

After that, make sure apt-get is really fixed:

sudo apt update
sudo apt dist-upgrade
sudo apt autoremove

Done!

Problem 2: Laggy Desktop: Reprise

With apt-get fixed, I can now uninstall & reinstall the NVidia drivers to fix the laggy desktop:

sudo apt purge nvidia*
sudo apt-get check
sudo apt update
sudo apt upgrade
sudo apt autoremove
sudo reboot

Problem fixed! So I reinstalled the NVidia binary driver:

sudo ubuntu-drivers autoinstall
sudo reboot

Problem 4: Python 3 Broken

I use Python virtual environments and virtualenvwrapper. The upgrade broke these and I was getting a virtualenv related error message every time I opened a terminal. To fix this, I had to reinstall pip and virtualenvwrapper:

python -m pip uninstall pip
python -m pip install pip
pip install virtualenvwrapper

I did this in the system default python (python 2) because that I run virtualenv from the command line.

Fixed!

Problem 5: Desktop Crashes

At this point, my desktop was working pretty well in Ubuntu 18. But I was disappointed to find that periodically, from every 10 minutes to every hour, the computer would crash entirely and revert to a text mode screen. After such a crash I could ssh to it from another machine, so the machine was still running, it was just the desktop that crashed. From ssh, I could kill Xorg and the login prompt would appear on that desktop.

I found this bug report, which provides a workaround: add a parameter to the linux kernel when booting

GRUB_CMDLINE_LINUX_DEFAULT="scsi_mod.scan=sync"

This seems to have fixed it, though only time will tell.

Update: the system still crashes. This does not fix the problem. More specifically, the desktop suddenly goes black and I must ssh from another computer, kill Xorg and it restores the login prompt.

As I’m experiencing these Xorg crash/hangs, I’ll list the various things I’ve tried that don’t fix it:

  • adding kernel param “scsi_mod.scan=sync”
  • disabling display power management in XFCE power Manager (screen never powers off)
  • disabling screen saver (screen saver never kicks in)
  • disabling screen blank (screen never goes blank)
    • … PENDING … no crash yet, this might actually fix it!