11

I have tried everything to install MariaDB on this clean Ubuntu installation but I keep getting this error,

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-5.5 (= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have followed this guide to try and install it, http://www.unixmen.com/install-lemp-server-nginx-mysql-mariadb-php-ubuntu-13-10-server/

And I have also followed the "official" guide on the MariaDB downloads page for 13.10 https://downloads.mariadb.org/mariadb/repositories/

But nothing seems to be working.

Edit 1

I have tried both How do I resolve unmet dependencies after adding a PPA? and How to install MariaDB? but it still gives me the error I posted above.

It's a fresh Ubuntu install with hardly anything installed.

Edit 2

All the check boxes are ticket in Updates. I ran:

sudo apt-get update && sudo apt-get -f install mariadb-server-5.5"=5.5.33a+maria-1~saucy"

And it gave me this error:

The following packages have unmet dependencies:
mariadb-server-5.5 : Depends: mariadb-client-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
Depends: mariadb-server-core-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Andreas
  • 223
  • 1
  • 2
  • 6
  • Run this command once to install the listed package :sudo apt-get update && sudo apt-get -f install mariadb-server-5.5"=5.5.33a+maria-1~saucy" Be sure that you've ticked all the check-boxes under Updates tab in Software Sources. To verify it run : sudo software-properties-gtk to open Software Sources. If you get any error/message in the command I've mentioned above post it in your question. – Saurav Kumar Oct 26 '13 at 15:36
  • It seems that you're going to solve your issue soon. The main trick is that you've to list all the needed packages in one line to install. For example as from your new output you've to execute: sudo apt-get -f install mariadb-server-5.5"=5.5.33a+maria-1~saucy mariadb-client-5.5"=5.5.33a+maria-1~saucy" mariadb-server-core-5.5"=5.5.33a+maria-1~saucy" Catch the pattern what I'm doing, so if you get some more packages to install you've to include that in the same line as following the same patter. I know it would be difficult but hope it would help you. Reply. – Saurav Kumar Oct 26 '13 at 15:54
  • Right, I managed to install mariadb-common and tried to install libmariadbclient18 which depends on libmysqlclient18 but it says I already have libmysqlclient18 same with libdbd-mysql-perl. – Andreas Oct 26 '13 at 16:03
  • @Ecaz Have you found a solution for your problem? I'm experiencing the same. – Jon Koops Oct 26 '13 at 22:10
  • I'm getting this error: libmariadbclient18 : Depends: libmysqlclient18 (= 5.5.33a+maria-1~saucy) but 5.5.34-0ubuntu0.13.10.1 is to be installed – Jon Koops Oct 26 '13 at 22:33
  • @JonKoops No solution. I got the same error and when I tried to install libmysqlclient18 it said I already had it installed... So I gave up and installed MySQL instead. – Andreas Oct 27 '13 at 00:01

4 Answers4

17

See Version Mismatch between Mariadb and Ubuntu Debian Repositories

It is rare for the version numbers of mysql-common or libmysqlclient to be higher in the official Ubuntu or Debian repositories than they are in the MariaDB repositories, but it has happened. Whenever it has it has been because of critical bug fix releases for bugs that existed in the version of MySQL in the distribution repositories but which had already been fixed in the version of MariaDB in the MariaDB repositories.

If a situation as described above exists when you try to install MariaDB you will get an error like this:
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
A way to fix this is to specify the exact version of the two packages that you want to install. To do this, first determine the full version numbers of the affected packages. An easy way to do so is with 'apt-cache show':
apt-cache show mysql-common | grep Version
apt-cache show libmysqlclient18 | grep Version

This is the situation as of this writing, since the version numbers are shown as:

Version: 5.5.34-0ubuntu0.13.10.1
Version: 5.5.34+maria-1~saucy

The MariaDB page gives two solutions.

First solution: Specifying the package version

For each of the above you will be given a list of versions. The ones in the MariaDB repositories will have "mariadb" in the version strings and are the ones you want. With the version numbers in hand you will be able to install MariaDB by explicitly specifying the version numbers like so:
apt-get install mariadb-server-5.5 mariadb-client-5.5 \
libmysqlclient18=<version-number> \
mysql-common=<version-number>

which is

apt-get install mariadb-server-5.5 mariadb-client-5.5 \
 libmysqlclient18=5.5.34+maria-1~saucy \
 mysql-common=5.5.34+maria-1~saucy

NOTE: Update to 5.5.34 to reflect current version as of 2014.01.28 [RealPariah] After installation, you need to hold the packages until the version numbers get back in sync.

After MariaDB is installed, and as long as the version number issue exists, an `apt-get dist-upgrade` will try to remove MariaDB in order to install the "upgraded" libmysqlclient and mysql-common packages. To prevent this from happening you can hold them so that apt doesn't try to upgrade them. To do so, open a terminal, become root with `sudo -s`, and then enter the following:
echo libmysqlclient18 hold | dpkg --set-selections
echo mysql-common hold | dpkg --set-selections
The holds will prevent you from upgrading MariaDB, so when you want to remove the holds, open a terminal, become root with 'sudo -s', and then enter the following:
echo libmysqlclient18 install | dpkg --set-selections
echo mysql-common install | dpkg --set-selections
You will then be able to upgrade MariaDB as normal (e.g. with `sudo apt-get update; sudo apt-get upgrade`).

How do I know when the version numbers match again?

You can track the MariaDB version number by signing up for an email alert of new releases at MariaDB.org. According to the site, it is a low-traffic announce-only list.

Additionally, when the package versions are once again in sync, you should stop seeing a message in apt that only the 2 held packages will be held, but that all mariadb packages will be held:

The following packages have been kept back:
libmariadbclient18 libmysqlclient18 linux-generic linux-headers-generic
linux-image-generic mariadb-client-5.5 mariadb-client-core-5.5
mariadb-server mariadb-server-5.5 mariadb-server-core-5.5 mysql-common

This indicates the package numbers are back in sync, which can also be checked in synaptic or similar tools.

Second solution: Pinning the MariaDB Repository

Another thing you can do is to pin the MariaDB repository that you use. This is done by creating a file under `/etc/apt/preferences.d/` with the following contents:
Package: *
Pin: origin <mirror-domain>
Pin-Priority: 1000

Replace <mirror-domain> with the domain name of the MariaDB mirror you use. For example, ftp.osuosl.org. With the pin file in place, packages from your MariaDB repository will have priority over packages from the system repositories.

You can find the mirror name you are using in System Settings >> Software & Updates, or if you are using another flavor of Ubuntu, Synaptic >> Settings >> Repositories, or cat /etc/apt/sources.list.

The Pin-Priority in this case needs to be greater than or equal to 1000, which causes a version to be installed even if this constitutes a downgrade of the package

(See man 5 apt_preferences for more information on options in other cases.)

Naming the pinning preferences file

Note that the file in the /etc/apt/preferences.d directory are parsed in alphanumeric ascending order and need to obey the following naming convention:

The files have either no or "pref" as filename extension and only contain alphanumeric, hyphen (-), undescore (_), and period (.) characters. Otherwise APT will print a notice that it has ignored a file...

(Source: man 5 apt_preferences)

So, the name itself doesn't matter, but a good name would be something like 50_mariadb. This identifies the package involved and allows other pinning preferences files to be easily placed before of after this file in the processing order.

chaskes
  • 15,246
  • I will try the first solution but how do you know when the mismatch has been fixed? Do I have to scour the change log every time they release an update? – Andreas Oct 27 '13 at 04:32
  • I used the first method and it went very smoothly. No worries about dependencies at all. I edited the answer with info on the mariadb version number – chaskes Oct 27 '13 at 05:58
  • What should the name of the pinning file be for the second solution? – Thomas Taylor Nov 04 '13 at 03:55
  • I ♥ you for your skills. The mariadb packages are pretty screwed up. I assert this based on the fact that I've never had to do any of the above before, but the above got me installed. Thanks! – jettero Nov 08 '13 at 12:22
  • 1
    @thomas-taylor Added info in naming the pinning file. – chaskes Nov 08 '13 at 15:26
  • @jettero Thanks for the kind words. It has to do with mariadb needing to use the same package names for the 2 affected packages as mysql uses in order to allow you to use 3rd party packages that have mysql as a dependency to work with mariadb. They say they're working on a solution for this. – chaskes Nov 08 '13 at 15:29
2

I had a similar issue in Ubuntu 14.10 upgrading from MySQL to Maria DB. Namely I would get stuck with

 libmysqlclient18:amd64 10.0.16+maria-1~utopic (Multi-Arch: no) is not co-installable with libmysqlclient18 which has multiple installed instances

After following these suggestions to no avail, the following helped me greatly: How to Replace MySQL with MariaDB in Ubuntu Server by JournalXtra.

Editing /var/lib/dpkg/status and removing the two instances of libmysqlclient18 like this:

Package: libmysqlclient18
Status: deinstall ok config-files
Priority: optional
Section: libs
Installed-Size: 3392
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Multi-Arch: same
Source: mysql-5.5
Version: 5.5.40-0ubuntu1
Config-Version: 5.5.40-0ubuntu1
Depends: mysql-common (>= 5.5.40-0ubuntu1), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), zlib1g (>= 1:1.1.4)
Pre-Depends: multiarch-support
Description: MySQL database client library

MySQL is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use.

This package includes the client library. Homepage: http://dev.mysql.com/ Original-Maintainer: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>

Allowed me to install MariaDB smoothly afterwards.

sudo apt-get install mariadb-server

Note: I did get here after many attempts at this removing libmariadbclient18 and libmysqlclient18 before this solution worked. I couldn't get past apt-get issues until these two were removed since they were reported as broken packages before I could attempt any other repair.

Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26
m1st0
  • 109
0

To solve the issue, I remove the earlier installation of mysql

sudo apt remove mysql-server

And then installed mariadb-server

sudo apt install mariadb-server

This applies to fresh installation, if you already have mysql running, don't try this solution.

0

I've landed on this pages by looking for this problem solution with the same error. I hope my experience will help someone.

In my case, I've added wrong MariaDB repository version (20.10 "groovy" repo to the 20.04 "focal" server) and the problem was gone after fixing this issue.