Working around the Percona MySQL RPM dependancy conflict on RHEL/CentOS 5

First off I want to say that what you’re about to see is a tactical retreat from best practices that should very much be considered the exception.

In a CentOS/RHEL 5 environment installing the Percona MySQL rpm’s will include installing a package named MySQL-shared-percona. That package provides two key client libraries:

[root@server1 ~]# rpm -ql MySQL-shared-percona
/usr/lib64/libmysqlclient.so
/usr/lib64/libmysqlclient.so.16
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient_r.so
/usr/lib64/libmysqlclient_r.so.16
/usr/lib64/libmysqlclient_r.so.16.0.0

The plain old mysql package from RHEL upstream on the other hand provides one version back:

[root@server2 ~]# rpm -ql mysql | grep libmysql
/usr/lib64/mysql/libmysqlclient.so.15
/usr/lib64/mysql/libmysqlclient.so.15.0.0
/usr/lib64/mysql/libmysqlclient_r.so.15
/usr/lib64/mysql/libmysqlclient_r.so.15.0.0

The packages in RHEL/CentOS 5 repos (including EPEL) are complied expecting “15″, but our Percona MySQL RPM is giving us “16″. Yum’s solution is to try and install both, but there’s a catch.

Take for instance this attempt to install the Maatkit rpm. It requires perl-DBD-mysql which being a native distro package is expecting version “15″ of those libraries.

[root@server1 ~]$ yum localinstall --nogpgcheck maatkit-5014-1.noarch.rpm
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining maatkit-5014-1.noarch.rpm: maatkit-5014-1.noarch
Marking maatkit-5014-1.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
* addons: centos.mirror.nac.net
* base: mirror.cs.vt.edu
* epel: serverbeach1.fedoraproject.org
* extras: mirror.trouble-free.net
* updates: centos.mirror.nac.net
Resolving Dependencies
--> Running transaction check
---> Package maatkit.noarch 0:5014-1 set to be updated
--> Processing Dependency: perl(DBD::mysql) >= 1.0 for package: maatkit
--> Processing Dependency: perl(Term::ReadKey) >= 2.10 for package: maatkit
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: perl-DBD-MySQL
---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated
--> Running transaction check
---> Package mysql.x86_64 0:5.0.77-3.el5 set to be updated
--> Processing Conflict: mysql conflicts MySQL
--> Finished Dependency Resolution
mysql-5.0.77-3.el5.x86_64 from base has depsolving problems
--> mysql conflicts with MySQL-server-percona
Error: mysql conflicts with MySQL-server-percona
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

MySQL-server-percona explicitly conflicts with mysql. Similar results can be found with anything that requires php-mysql.

So now what?

Well it turns out the upstream MySQL packages have accounted for this. They put out a “-compat” package for lots of versions of lots of distros, in this case including RHEL 5, that contains the other library versions that the “normal” mysql package would normally have provided. Downloadable from here.


[root@server1 ~]# rpm -qlp MySQL-shared-compat-5.1.39-0.rhel5.x86_64.rpm
/usr/lib64/libmysqlclient.so
/usr/lib64/libmysqlclient.so.12
/usr/lib64/libmysqlclient.so.12.0.0
/usr/lib64/libmysqlclient.so.14
/usr/lib64/libmysqlclient.so.14.0.0
/usr/lib64/libmysqlclient.so.15
/usr/lib64/libmysqlclient.so.15.0.0
/usr/lib64/libmysqlclient.so.16
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient_r.so
/usr/lib64/libmysqlclient_r.so.12
/usr/lib64/libmysqlclient_r.so.12.0.0
/usr/lib64/libmysqlclient_r.so.14
/usr/lib64/libmysqlclient_r.so.14.0.0
/usr/lib64/libmysqlclient_r.so.15
/usr/lib64/libmysqlclient_r.so.15.0.0
/usr/lib64/libmysqlclient_r.so.16
/usr/lib64/libmysqlclient_r.so.16.0.0

Thing is, that won’t install clean on its own because it also tries to provide “16″, which conflicts with the Percona package:

[root@server1 ~]$ rpm -Uvh MySQL-shared-compat-5.1.39-0.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
file /usr/lib64/libmysqlclient.so.16.0.0 from install of MySQL-shared-compat-5.1.39-0.rhel5.x86_64 conflicts with file from package MySQL-shared-percona-5.1.39-8.rhel5.x86_64
file /usr/lib64/libmysqlclient_r.so.16.0.0 from install of MySQL-shared-compat-5.1.39-0.rhel5.x86_64 conflicts with file from package MySQL-shared-percona-5.1.39-8.rhel5.x86_64

So here’s where we have to do the old one-step-back thing and –force it:

[root@server1 ~]$ rpm -Uvh MySQL-shared-compat-5.1.39-0.rhel5.x86_64.rpm --force
Preparing... ########################################### [100%]
1:MySQL-shared-compat ########################################### [100%]

Now for the case of the non “16″ libraries this is good because it gives us something that should be close enough. However for the specific libraries that our new server and client packages are built to use it’d be nice if they were dealing with the right copy, so now we force the Percona -shared package back on top of the MySQL one we just installed:

[root@server1 ~]$ rpm -Uvh MySQL-shared-percona-5.1.39-8.rhel5.x86_64.rpm --force
Preparing... ########################################### [100%]
1:MySQL-shared-percona ########################################### [100%]

Now we have all the versions of the mysql client libraries we need, and things install cleanly:

[root@server1 ~]$ yum localinstall maatkit-5014-1.noarch.rpm --nogpgcheck
Loaded plugins: fastestmirror
Setting up Local Package Process
Examining maatkit-5014-1.noarch.rpm: maatkit-5014-1.noarch
Marking maatkit-5014-1.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
* addons: centos.mirror.nac.net
* base: mirror.cs.vt.edu
* epel: serverbeach1.fedoraproject.org
* extras: centos.mirror.nac.net
* updates: centos.mirror.nac.net
Resolving Dependencies
--> Running transaction check
---> Package maatkit.noarch 0:5014-1 set to be updated
--> Processing Dependency: perl(DBD::mysql) >= 1.0 for package: maatkit
--> Processing Dependency: perl(Term::ReadKey) >= 2.10 for package: maatkit
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated
---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================================================================================================================
Installing:
maatkit noarch 5014-1 /maatkit-5014-1.noarch 3.2 M
Installing for dependencies:
perl-DBD-MySQL x86_64 3.0007-2.el5 core-0 148 k
perl-TermReadKey x86_64 2.30-4.el5 epel 32 k

Transaction Summary
================================================================================================================================================================================================================================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total size: 3.4 M
Total download size: 179 k
Is this ok [y/N]: y
(1/2): perl-TermReadKey-2.30-4.el5.x86_64.rpm | 32 kB 00:00
(2/2): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | 179 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-TermReadKey 1/3
Installing : perl-DBD-MySQL 2/3
Installing : maatkit 3/3

Installed:
maatkit.noarch 0:5014-1

Dependency Installed:
perl-DBD-MySQL.x86_64 0:3.0007-2.el5 perl-TermReadKey.x86_64 0:2.30-4.el5

Complete!

Ta Da. You can yum install with abandon again.

Credit to David Murphy for the key step here from his comments on here.

3 Responses to “Working around the Percona MySQL RPM dependancy conflict on RHEL/CentOS 5”

  1. Wart says:

    thanks for this !

    i ran into the same issue and was wondering how to resolve it.

    your solution worked perfectly.

    cheers !

  2. Onno says:

    Thanks for this, but you have a small error in your rpm commands. you use: rpm -Uvh, but that won’t do the trick. It just removes the other ’shared-compat’ package. So when you install (or more precise update) the MySQL-shared-percona-5.1.39-8.rhel5.x86_64.rpm package, MySQL-shared-compat-5.1.39-0.rhel5.x86_64.rpm will be removed together with the libs where this is all about. ;o)

    So just use ‘rpm -ivh –force’ instead of ‘rpm -Uvh –force’ and it will do the job for you.

    Thanks!

  3. jim says:

    Thanks for the catch Onno.

    In related good news, percona is now offering a yum repo with the -compat package to address this! I haven’t had a chance to test it yet but I’ll edit the post when I do.

Leave a Reply