Tuesday, March 19, 2013

Percona/MariaDB libmysqlclient18 dependency snafu

Sometimes the efficiencies of the apt tools in Ubuntu amaze me. There I was running along happily with MariaDB and decided to do a sudo apt-get dist-upgrade, the command has never failed me in the past, so I was confident that Ubuntu would figure out the "correct" thing to do and I blindly confirmed the recommendation without reading what apt was going to do. BAM! A few seconds later MariaDB is successfully uninstalled *blink* what? No problem a simple reinstall should fix that, easy peasy. Well you see the thing is that now there is this dependency problem with libmysqlclient18 and Ubuntu can't figure out how to resolve that so... no db for you!.

I guess what happens is the MariaDB (and Percona too I found out) repositories package a different version of the libmysqlclient18 in thier repective repositories. Sometimes Oracle (The owner of MySQL) releases a newer version of libmysqlclient18 without much notice. Apt thinks the new version is the hot ticket to install and installs it, but the DB in question still need the old version of the package, since it isn't installed anymore they are removed.

There are a few solutions.

  1. Don't do a dist-upgrade, instead do an upgrade... this should prevent the upgrade that removes maria/percona. 
  2. Create a preference file for your repository of choice that tells Ubuntu that, use the version of packages from the DB repository, not your own standard repsitory. 
I struggled to find any great documentation on how to create the preference file to pin the db packages so they come from the repository, so here is the shortcut version.

The big help for me was this post that details how to install percona on Ubuntu 12.10. http://ubuntuforums.org/showthread.php?t=2116360

You need to create a file in /etc/apt/preferences.d/yourFileName.pref

This is what I put in mine:
Package: *
Pin: release o=Percona Development Team
Pin-Priority: 1001

This tells apt to give preference to any package that is contained in the Percona repo. You can replace the * with a specific package, which will only impact that one package. You can also have different levels of preferences by adjusting the Pin-Priority attribute for more preference (higher number) or less preference (lower number).

In order to find the info for the o= switch. I pointed my browser to the address that is listed in /etc/apt/sources.list for that repo, then navigate to the conf/distributions file. The entry you are looking for is the Origin line, that is what you put on the Pin: release o=<put the info from the distributions file, origin line>

For Percona this is the file: http://repo.percona.com/apt/conf/distributions
For MariaDB this is the file(i use the OSU OSL repo, so adjust for yourself): http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu/conf/distributions

Once I did this and apt-get update I was able to install just like normal.

No comments:

Post a Comment