In the few times I've done this, they have never been fun. My server has now gone from 12.04 all the way to 20.04 (I had intended to upgrade all the way to 22.04, but it seems 22.04 hasn't been out long enough). But getting there involved many hours of painful troubleshooting, desperately searching online for possible answers, thinking hard about what the problem could be, shooting in the dark, and miraculously hitting the issue through this spread fire approach.
Here, I document the many common causes I encountered, which didn't fix my problem, along with the fix which did. TL;DR: if you have integrated Intel graphics, remove the xserver-xorg-intel package.
When I first began this journey, I was young and naive, content with using Ubuntu 16.04LTS for as long as possible. Since earlier this year, it was no longer getting feature updates, and was only getting security updates. I was fine with that. Everything worked as it should. Though I was naive, I still remembered how painful it was the last time I had upgraded Ubuntu, from 14.04 to 16.04. It was a nerve wracking experience I never hoped to relive.
Then, my email stopped working. Gmail had been getting more and more pushy about restricting access to "unsecure" 3rd party applications, and they finally pulled the plug and wouldn't allow my email to flow into Evolution, a Linux email client. For a while, I tolerated it. But, the friction was building up. Finally, over the weekend, I took a look, decided that 16.04 was reaching end of life, and it was probably a good time to move on. So, I braced myself, and opened this bulging can.
The upgrade instructions are easy:
sudo do-release-upgrade -c
The first command checks for available upgrades. The second command kicks off the upgrade. I ran these two commands from a terminal window inside of an Ubuntu Desktop that I connected to remotely using nomachine inside a virtual machine on my desktop computer. Everything looked good as my 16.04 installation was upgraded to 18.04. Some packages were removed, that I needed for my server, but I'll figure that out later. After everything was done, it prompted me to reboot. I rebooted, and to my horror, while I could connect to the server using nomachine, there was no session, no GUI, no screen. "Here we go...", I thought.
Here is a list of possible fixes that I tried, which work for many people, but not for me:
I tried to figure out if the UUID labels for the hard drive partitions got messed up. They weren't:
ls -l /dev/disk/by-uuid/ | grep sda1
I disabled Secure Boot from within the motherboard bios configuration.
From the boot menu, press "e" when the item you wish to boot into is highlighted. Then, replace "quiet splash" with "nomodeset dis_ucode_ldr". Then, press "F10".
I tried booting into older versions of the kernel:
From the boot menu, select the "more options" item. Then, select one of the boot options from the subsequent menu.
For me, I was able to boot into the older 3.x kernels. Version 4.x kernels were flakey. However, I could only get the recovery mode working even with the 3.x kernels.
From within the recovery mode, I would first select "Enable Networking", which would also remount the root partition in read/write mode. Then, I would select the "root shell" option. I connect to wifi with these commands:
nmcli dev wifi list
nmcli -a dev wifi connect <network-ssid>
Now, I was at a fork in the road. I could either try to fix the booting issue before moving on to upgrading to 20.04 and potentially face any new problems then, or I could go ahead and upgrade and deal with all the problems at that point. I chose to go with the second option, and performed the same "do-release-upgrade" instructions as above. During this upgrade, I started getting "could not get modinfo from crc32" errors when grub was updating. These issues were resolved by running:
While now in 20.04, the 5.x kernel could be successfully booted into recovery mode, I was still getting a blank screen that seemed to be frozen.
I tried reinstalling ubuntu-desktop from recovery mode root shell, but that didn't fix the issue:
sudo apt update
sudo apt upgrade
sudo apt autoremove
sudo apt remove ubuntu-desktop
sudo apt autoremove
sudo apt install ubuntu-desktop
sudo dpkg -i nomachine7.10.1_amd64.deb
I noticed that the server was freezing on boot up, so I started getting a hunch that it was a graphics issue. In addition, I was able to boot up into recovery mode, so I knew it could work, if maybe I could boot up into text only. Didn't fix the issue:
From the boot menu, press "e" while highlighting the line item to boot in. Replace "quiet splash" with "text nosplash".
At this point, I was getting pretty frustrated, and decided to comb through the log files. It was when I was going through /var/log/boot.log that I noticed the boot up constantly had an error starting the Kernel Load Module. Looking inside that, I found that it couldn't find the "intel" module:
systemctl status systemd-modules-load.service
Just as a hunch, I removed "xserver-xorg-intel":
apt remove xserver-xorg-intel
Then, on the next boot up, I still got a blank screen, but through nomachine, I was able to connect remotely, and was greeted with the gdm login screen.
Fun! Now, as a bonus, and something important to note if you're upgrading from 18.04 to 20.04, and are using MySQL, with Ubuntu 20.04, MySQL is upgraded from 5.7 to 8, which isn't backwards compatible. So, I was left unable to read or backup my databases. I had to revert to 5.7, back up my databases, and then upgrade to 8, which then updated my databases. I find it strange that it didn't update my databases when I upgraded from 18.04 to 20.04. Anyways, here are the instructions:
sudo apt update
sudo apt install wget -y
sudo dpkg -i mysql-apt-config0.8.12-1all.deb
Choose "Ubuntu Bionic".
Choose "MySQL Server and Cluster".
Choose "MySQL 5.7".
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29You should see an option for version 5.7.
sudo apt update
sudo apt-cache policy mysql-server
sudo apt install -f mysql-client=5.7* mysql-community-client=5.7* mysql-community-server=5.7* mysql-server=5.7*Once that's done, backup the databases:
mysqldump --all-databases > dump.sql
Then, upgrade back to 8.0, which should automatically upgrade the databases as well.
sudo apt install mysql-client mysql-server
All in a weekend's work. Hope everything works for you!