Upgrading Server: Ubuntu 14.04 to 16.04

Hi, I’m Vigas and this is my first post on medium. In this post I will share my personal experience to upgrade the server OS at http://gdy.club, which is a production server at my ex-college, Guru Nanak Dev Engineering College, Ludhiana.

I had my fair share of struggles during the upgrade, so I thought sharing it here might help someone.

  1. Backup! why? Suppose you upgrade and later, MySQL cannot read the databases due to some corrupt files. Similarly, many cases of disaster are there serving as example. One must backup all important data to ensure that we have all the data we need, if anything goes wrong.
    How did I do backup?! Since I was operating from my home and remotely doing everything. I did a manual backup, created a .tar.gz of few important things and uploaded on a private FTP server hosted at servers.com.
  2. Upgrade procedure: Here are the list of commands which are general instructions to update a Ubuntu server, however sometimes they don’t work as they are supposed to, due to some third party conflicts.
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt-get install update-manager-core
    sudo do-release-upgrade
  3. The Problem: After executing last command, I encountered following error, “An unsolvable problem occurred while calculating the upgrade”, hence server did not upgrade.
Screenshot of the error occurred

Tracing the problem: I traced the logs by using the command below, and found conflict errors with lot of mono-devel packages, among others.

grep Broken /var/log/dist-upgrade/apt.log

I tried by removing some of the packages which were having conflicts, and also removed package named ‘findutils’. It was an important package, since dpkg / apt-get, both of them were dependent on find command, so now I couldn’t install anything new. After trying several unsuccessful methods of installing findutils, I took a short break. System was all broken, thankfully SSH was working, as I needed dpkg to continue with upgrade, I needed to figure out a way to install find command. I tried moving my local find executable file to server, but it did not work due to different architecture. Now I got another idea, Downloaded findutils deb archive with compatible architecture. Since I could not install the deb file without dpkg. I extracted the .deb archive by doing

ar x findutils.deb

And I was able to locate find command inside the extracted files, and I tried executing, and voila! It worked. I placed find executable in system executable path, and dpkg started working. I immediately fired the command to install findutils again.

$ sudo apt-get install findutils

Now, back to square one, the initial challenge, upgrading the server. I was now looking for alternate options to upgrade, and found something at AskUbuntu: https://askubuntu.com/questions/760347/how-to-upgrade-from-14-04-lts-or-15-10-to-16-04-from-terminal

Open sources.list in your favorite editor

sudo vim /etc/apt/sources.list

Change every occurrence of ‘trusty’ to ‘xenial’, trusty denotes ubuntu 14.04 and xenial denotes 16.04. Moving on with the upgrade by issuing following commands.

sudo apt-get update && sudo apt-get dist-upgrade

After the upgrade, clean the obsolete packages by issuing

sudo apt-get autoremove --purge -y;sudo apt-get clean

And that’s was my personal experience of the upgrade. Looking forward to read more challenges? hit claps and subscribe, I’ll be in touch.