can't update server with yum, duplicates error

adam monro asked:

trying to run yum update and getting sum errors, can’t seem to get passed them, tried “skip-broken”, tried yum-complete-transaction, package-cleanup –dupes, package-cleanup –cleandupes … nothing seems to work, here is yum update output:

Loaded plugins: fastestmirror, priorities, replace
Setting up Update Process
Loading mirror speeds from cached hostfile
 * ius: mirror.rackspace.com
drivesrvr                                                                                     | 2.2 kB     00:00
Resolving Dependencies
--> Running transaction check
---> Package coreutils.x86_64 0:8.4-37.el6_7.3 will be updated
--> Processing Dependency: coreutils = 8.4-37.el6_7.3 for package: coreutils-libs-8.4-37.el6_7.3.x86_64
---> Package coreutils.x86_64 0:8.4-43.el6 will be an update
---> Package glibc.i686 0:2.12-1.166.el6_7.7 will be updated
--> Processing Dependency: glibc = 2.12-1.166.el6_7.7 for package: glibc-common-2.12-1.166.el6_7.7.x86_64
---> Package glibc.i686 0:2.12-1.192.el6 will be an update
---> Package krb5-libs.i686 0:1.10.3-42z1.el6_7 will be updated
---> Package krb5-libs.i686 0:1.10.3-57.el6 will be an update
---> Package libselinux.i686 0:2.0.94-5.8.el6 will be updated
---> Package libselinux.i686 0:2.0.94-7.el6 will be an update
---> Package openssl.i686 0:1.0.1e-42.el6_7.4 will be updated
---> Package openssl.i686 0:1.0.1e-48.el6_8.1 will be an update
---> Package python-boto.noarch 0:2.38.0-1.el6 will be obsoleted
---> Package python-rsa.noarch 0:3.1.1-5.el6 will be obsoleted
---> Package python2-boto.noarch 0:2.41.0-1.el6 will be obsoleting
---> Package python2-rsa.noarch 0:3.4.1-1.el6 will be obsoleting
--> Processing Dependency: python-pyasn1 for package: python2-rsa-3.4.1-1.el6.noarch
--> Running transaction check
---> Package coreutils.x86_64 0:8.4-37.el6_7.3 will be updated
--> Processing Dependency: coreutils = 8.4-37.el6_7.3 for package: coreutils-libs-8.4-37.el6_7.3.x86_64
---> Package glibc.i686 0:2.12-1.166.el6_7.7 will be updated
--> Processing Dependency: glibc = 2.12-1.166.el6_7.7 for package: glibc-common-2.12-1.166.el6_7.7.x86_64
---> Package python-pyasn1.noarch 0:0.0.12a-1.el6 will be installed
--> Finished Dependency Resolution
Error: Package: coreutils-libs-8.4-37.el6_7.3.x86_64 (@updates)
           Requires: coreutils = 8.4-37.el6_7.3
           Removing: coreutils-8.4-37.el6_7.3.x86_64 (@updates)
               coreutils = 8.4-37.el6_7.3
           Updated By: coreutils-8.4-43.el6.x86_64 (base)
               coreutils = 8.4-43.el6
Error: Package: glibc-common-2.12-1.166.el6_7.7.x86_64 (@updates)
           Requires: glibc = 2.12-1.166.el6_7.7
           Removing: glibc-2.12-1.166.el6_7.7.i686 (@updates)
               glibc = 2.12-1.166.el6_7.7
           Updated By: glibc-2.12-1.192.el6.i686 (base)
               glibc = 2.12-1.192.el6
 You could try using --skip-broken to work around the problem
** Found 8 pre-existing rpmdb problem(s), 'yum check' output follows:
coreutils-libs-8.4-43.el6.x86_64 is a duplicate with coreutils-libs-8.4-37.el6_7.3.x86_64
coreutils-libs-8.4-43.el6.x86_64 has missing requires of coreutils = ('0', '8.4', '43.el6')
glibc-2.12-1.192.el6.x86_64 is a duplicate with glibc-2.12-1.166.el6_7.7.i686
glibc-common-2.12-1.192.el6.x86_64 is a duplicate with glibc-common-2.12-1.166.el6_7.7.x86_64
krb5-libs-1.10.3-57.el6.x86_64 is a duplicate with krb5-libs-1.10.3-42z1.el6_7.i686
libselinux-2.0.94-7.el6.x86_64 is a duplicate with libselinux-2.0.94-5.8.el6.i686
openssl-1.0.1e-48.el6_8.1.x86_64 is a duplicate with openssl-1.0.1e-42.el6_7.4.i686
2:shadow-utils-4.1.5.1-5.el6.x86_64 is a duplicate with 2:shadow-utils-4.1.4.2-19.el6_6.1.x86_64

My answer:


The problem is that the RPM database contains two entries for certain packages, both an old and new version.

This happens when a previous yum update was interrupted, and never completed later. It appears in your case, this has probably happened more than once. (You should avoid interrupting yum transactions. If one is interrupted, you should immediately finish it with yum-complete-transaction. NEVER attempt to manually stop a running transaction. You can always undo it later.)

Yum can recover from this sometimes, but occasionally yum gets lost. In this case you’re going to need to straighten things out yourself.

There is a tool called package-cleanup which can sometimes fix these problems, but it has been known to attempt to select too many packages and try to delete everything on the system, which is why I generally don’t trust it.

I would repair this manually. For each of the packages, this involves adjusting the RPM database so that it thinks there is no duplication, and then updating the system.

rpm -e --justdb coreutils-libs-8.4-37.el6_7.3.x86_64
rpm -e --justdb glibc-2.12-1.166.el6_7.7.i686

Note that here we are not actually erasing the packages, but only the rpmdb entries that tell that the packages are installed.

At this point it should be possible to update the system, with

yum distro-sync

(If not, you’ll need to remove the rpmdb entries for the rest of the packages, and then try again.)

If the packages for which rpmdb entries were removed aren’t reinstalled or updated by yum distro-sync, reinstall them.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.