Plesk upgrade fails due to duplicate rpm packages
An upgrade to Plesk 18 (Obsidian) may fail due to rpm packages which seem to coexist in different versions according to the rpm database. This condition is often caused by former failed upgrades. The following list shows a few examples:
psa-logrotate-3.8.2-cos6.build120140331.11.x86_64 psa-logrotate-3.8.2-cos6.build1708171004.18.x86_64 psa-12.5.30-cos6.build1205150826.19.x86_64 psa-17.8.11-cos6.build1708180301.19.x86_64 psa-qmail-rblsmtpd-0.88-cos6.build1205150814.17.x86_64 psa-qmail-rblsmtpd-0.88-cos6.build1708171004.18.x86_64 plesk-lmlib-0.2.4-0centos.6.180209.1429.x86_64 plesk-lmlib-0.1.1-centos6.623.15021818.x86_64
You can see that e.g. package psa is installed in version 12.5.30 and version 17.8.11, which is not possible at the same time. This is an inconsistency in the rpm database.
Locate duplicate packages
First you will have to find all packages that are installed in different versions. Install the yum-utils package on CentOS 7:
[root@server ~]# yum install yum-utils
Then request all duplicate packages with package-cleanup, a program that is available after installing yum-utils:
[root@server ~]# package-cleanup --dupes
Now you've got a package list like the example above. Create a new list by comparing the version numbers package by package und pick the oldest version numbers respectively. These are the packages that have to be removed.
Attention: Do not use the command package-cleanup --cleandupes or rpm -e paketname.rpm --nodeps
While the rpm packages are duplicates in the rpm database, the files on disk usually exist once only!
Most programs' filenames do not contain a version number, e.g. the Apache webserver's binary is called /usr/sbin/httpd in version 2.4.6 and it's called /usr/sbin/httpd in version 2.4.12 as well. If you remove just one package you will also remove the httpd binary and thus break your websites because the /usr/sbin/httpd binary is available on disk once only. In the worst case your whole system may be unusable!
Remove duplicate packages
The solution is to just remove the duplicate entries from the rpm database and not to touch any files in the filesystem. Execute the following command for every package that you want to remove:
[root@server]# rpm -e --nodeps -f --justdb psa-logrotate-3.8.2-cos6.build120140331.11.x86_64
It's important to note the additional parameter --justdb, which will simply remove the package entry from the rpm database but not the files mentioned within that package. Afterwards yum update or the plesk installer should work as usual.