Upgrading Ubuntu 14.04 -> 18.04 - MariaDB issues

This post covers only the issues I experienced when upgrading a remote VM on Ubuntu 14.04 to 18.04. Some fine folks online say "Don't do it" and others say "I just upgraded 100 VMs without any issue". If you are going to upgrade, ensure you have a good snapshot and backups. Upgrading is fraught with danger. 

Upgrading Ubuntu between OS versions is done simply with:

do-release-upgrade

Everything went perfectly... until... MariaDB. This error appeared:

The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.0 (>= 10.0.38-0ubuntu0.16.04.1) but it is not going to be installed

Upon close inspection of this line we see that maridb-server-10.0 is for Ubuntu 16.04. Wait, we're now on 18.04? The solution is in the MariaDB docs. Follow the instructions under section 'Updating the MariaDB APT repository to a New Major Release', which first required removing the old release:

sudo add-apt-repository --remove 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu jesse main'

Then, we need to add the new release:

sudo apt-get install software-properties-common 
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'

Before we run apt-get update, we need to add the public key to our setup using apt-key:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 <KEY>

Finally, at a minimum you will need to install the mariadb-server:

apt update
apt-get install mariadb-server

If /var/lib/mysql was removed during the whole upgrade process, you will need to pull your DB files from your back and restart MySQL. See anything I might have missed, or have suggestions, let me know below in the comments.

Read more…

Comments