Ubuntu – apt-get fails with unmet dependencies

aptMySQLpackagesUbuntu

I have a server running Ubuntu 12.04 on AWS and I can no longer install anything on apt-get because I get this error:

The following packages have unmet dependencies:
 mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.35-0ubuntu0.12.04.1) but 5.5.38-0ubuntu0.12.04.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I'm not sure what I did to cause this error but dpkg -l yields this:

ii  mysql-client-5.5                  5.5.40-0ubuntu0.12.04.1                             MySQL database client binaries
ii  mysql-client-core-5.5             5.5.38-0ubuntu0.12.04.1                             MySQL database core client binaries
ii  mysql-common                      5.5.40-0ubuntu0.12.04.1                             MySQL database common files, e.g. /etc/mysql/my.cnf
iU  mysql-server                      5.5.35-0ubuntu0.12.04.1                             MySQL database server (metapackage depending on the latest version)
iF  mysql-server-5.5                  5.5.35-0ubuntu0.12.04.1                             MySQL database server binaries and system database setup
ii  mysql-server-core-5.5             5.5.40-0ubuntu0.12.04.1

apt-get -f install fails with the same unmet dependencies issue

Is there a way I can clean this up – I'm hoping in such a way that I don't have to bring down the database for long if at all…?

Best Answer

I tried using aptitude to resolve the conflicts and it gave me additional information but I ultimately had to remove the various mysql packages and then reinstall them:

apt-get purge mysql-server*
apt-get install mysql-server

I wasn't able to fix the issue without first bringing down the database momentarily...