45

When I try running yum update on a CentOS 6.3 box, I am getting errors, and says to run yum check. The output of yum check is:

➜  ~  yum check
Loaded plugins: fastestmirror
glibc-2.12-1.107.el6_4.5.x86_64 is a duplicate with glibc-2.12-1.107.el6_4.4.x86_64
glibc-common-2.12-1.107.el6_4.5.x86_64 is a duplicate with glibc-common-2.12-1.107.el6_4.4.x86_64
glibc-devel-2.12-1.107.el6_4.5.x86_64 is a duplicate with glibc-devel-2.12-1.107.el6_4.4.x86_64
glibc-devel-2.12-1.107.el6_4.5.x86_64 has missing requires of glibc-headers = ('0', '2.12', '1.107.el6_4.5')
iputils-20071127-17.el6_4.2.x86_64 is a duplicate with iputils-20071127-17.el6_4.x86_64
nspr-4.9.5-2.el6_4.x86_64 is a duplicate with nspr-4.9.2-1.el6.x86_64
nss-3.14.3-4.el6_4.x86_64 is a duplicate with nss-3.14.0.0-12.el6.x86_64
nss-softokn-3.14.3-3.el6_4.x86_64 is a duplicate with nss-softokn-3.12.9-11.el6.x86_64
nss-util-3.14.3-3.el6_4.x86_64 is a duplicate with nss-util-3.14.0.0-2.el6.x86_64
tzdata-2013g-1.el6.noarch is a duplicate with tzdata-2013c-2.el6.noarch
2:xinetd-2.3.14-39.el6_4.x86_64 is a duplicate with 2:xinetd-2.3.14-38.el6.x86_64
Error: check all

Any idea how to fix these packages? I tried yum reinstall xinetd tzdata nss-util nss-softokn nss nspr iputils glibc glibc-common glibc-devel but got:

Error: Multilib version problems found. This often means that the root cause is something else and multilib version checking is just pointing out that there is a problem.

9 Answers 9

57

For me it looks like you rebooted your computer (or it crashed) while you where in the process of upgrading packages. So new packages where installed, but old packages where not removed.

First look if you have any uncomplete transactions with: yum-complete-transaction

If this doesn't help then take a look at the package-cleanup tool which is part of the yum-utils package.

package-cleanup --dupes lists duplicate packages

package-cleanup --cleandupes removes duplicate packages

But be carefull with the command and create a backup before removing duplicates.

5
  • 6
    yum-complete-transaction fixed it in my case, too. I had to yum install yum-utils to make this available, too. My machine didn't reboot during installation, but I lost my SSH connection during install and this seemed to halt the installation... Dec 30, 2014 at 21:30
  • 4
    package-cleanup --cleandupes broke my system, because it deletes the files owned by the removed duplicate, despite those files are also owned by the first copy/dup. I had glibc as a duplicate and, after running this command, I could not run anything else. In my case, rpm -e --justdb [duplicated packages] worked fine.
    – emi
    Mar 6, 2017 at 15:06
  • 1
    package-cleanup --cleandupes also broke my system :(
    – Johnny
    Jul 19, 2017 at 16:56
  • In my case, package-cleanup wouldn't run because of a conflicting package (caused by a half-run yum transaction). Removing the newer version of the conflicting package resolved the conflict and so package-cleanup --dupes worked just fine. Dec 4, 2017 at 16:59
  • 2
    package-cleanup --cleandupes did not work for me, but I was able to work around the issues with: for i in $(package-cleanup --dupes); do rpm -e --justdb $i --nodeps; done Dec 19, 2017 at 22:35
50

This is the way I did fix one CentOS 7 server with 471 dupes.

First I had to install yum utils:

yum install yum-utils

Have tried yum-complete-transaction and other stuff without luck, I gave up the transaction with:

yum-complete-transaction --cleanup-only

Then I got a sorted list of duplicated packages so I could identify older versions to remove filtering even and odd lines later:

package-cleanup --dupes | sort -u > dupes.out

Then I got a uninstall list from this sorted file this way:

cat dupes.out | grep -v 'Loaded plugins:' | sort -u | awk 'NR % 2 == 1' > uninstall.in

Then I removed from rpm database the old versions:

for f in `cat uninstall.in`; do rpm -e --nodeps -f --justdb $f; done

Finally I could continue on regular system upgrade:

yum upgrade

Some things to pay attention:

  • On this case, I have carefully reviewed the "package-cleanup --dupes" output to make sure how to generate the uninstall list.
  • I have tried a "reinstall the newer" approach inverting the list (awk 'NR % 2 == 0') but there where lots of packages not available anymore at that version (server was left this way for an year).
  • I thought about removing from rpmdb the newer packages, so upgrade later should reinstall everything, but after checking on filesystem installed files, it was clear for me that new versions were in place, with only older rpm entries still in rpmdb. Maybe your case is different.
5
  • Thanks a bunch bro! This fixed a botched upgrade I was doing while at work to my home fileserver. My phone's net connection blipped out, right in the middle of a transaction causing damn near 1200 dupes. A --cleandupes got it down below 100 or so, but this got the rest. Sep 5, 2019 at 23:51
  • In order to sort with older versions first you should use sort -V, not sort -u
    – iamc
    Oct 3, 2019 at 8:13
  • 3
    awk 'NR % 2 == 1' just removes every-other-line, which only removes the duplicate files if there is exactly one duplicate per package. A safer way to identify the older duplicate files: for p in $(package-cleanup --dupes | grep -v ' ' | sort -rV); do echo "$(rpm -q --qf "%{NAME}\n" $p) $p"; done | awk 'seen[$1]++' | awk '{print $2}' > remove.list Nov 17, 2019 at 18:41
  • Thanks a lot - very helpful starting point for where an update got very sick. I went with your third thought, and removed the newer packages from rpmdb - I was more confident things would be in a good state afterwards if I forced a reinstall. Also, for "git" related packages, I actually also got a conflict (between git216 and git2u) rather than pure duplicates, but the same approach (remove the newer from rpmdb and re-install) fixed that too. Dec 30, 2019 at 17:29
  • Yay, this actually fixed my CentOS 7 server that was stuck for a few weeks after an automatic update must've gotten messed up. Mar 24, 2021 at 2:45
9

I was able to remove all duplicates by using yum shell:

  1. I first ordered it to remove all packages using remove foo-package-*
  2. Then order it to install previous version by specifying the exact version install foo-package-3.14.1-5.i386 foo-package-3.14.1-5.x86_64
  3. Committing the transaction by run

After that, the duplicates were gone and I could update the system to current packages without problem and without introducing any new duplicates.

This works even for system packages like nss or yum.

3
  • try: package-cleanup --cleandupes Feb 14, 2014 at 7:55
  • 7
    @user1403360: that didn't work, it aborted because it wanted to remove yum Feb 14, 2014 at 13:03
  • Reinstalling coreutils with yum shell, then yum update works again. Thanks!
    – evalarezo
    Jan 2, 2017 at 22:22
5

Try running:

yum reinstall [package-new.version]

It is mean, if you get the output of yum check is:

# yum check
Loaded plugins: fastestmirror
nss-3.14.3-4.el6_4.x86_64 is a duplicate with nss-3.14.0.0-12.el6.x86_64

Do reinstall:

yum reinstall nss-3.14.3-4.el6_4.x86_64
2
  • Out of all the solutions I tried, this is the only one that worked for one last package that was stuck. Thanks! Aug 29, 2018 at 17:31
  • 1
    The same is for me! I tried numerous solutions. Some of them were dangerous and tried to remove all dependent packages (including yum). And this one looks safe. And it works!
    – Sergey
    May 26, 2021 at 20:16
2

A minor upgrade was interrupted by SSH disconnection. After handholding a few packages while trying to get other fixes to work, I ended up fixing the rest like so: sudo yum reinstall --skip-broken $(/usr/bin/package-cleanup --dupes -q |sort)

1
  • Worked great, required no manual intervention, thanks! Feb 1, 2021 at 21:34
1

First install yum utils and run cleanup afterwards to remove old duplicated packages

yum install yum-utils &&
package-cleanup –-cleandupes -y

hint: sometimes you need to run package-cleanup –-cleandupes few times

0

A couple of months ago I also ran into this problem after upgrading my fedora.

I also tried the package-cleanup utility and it started removing required libs rendering my workstation unworkable. Luckily I could reinstall Fedora not deleting my home partition.

Yesterday the same problem occured and I fixed it removing the older version of the duplicate.

For example: I got these duplicates:

  • oxygen-icon-theme-4.8.3-1.fc16.noarch is a duplicate with oxygen-icon-theme-4.8.2-1.fc16.noarch
  • sane-backends-libs-1.0.22-10.fc16.i686 is a duplicate with sane-backends-libs-1.0.22-8.fc16.i686

What I did is I used the yum remove sane-backends-libs-1.0.22-8.fc16.i686 and afterwards a yum update.

Everything is now working fine.


from http://forums.fedoraforum.org/showthread.php?t=268328

0

In my case nothing above has worked.

So after having the Duplicates list, I copied it to a Text Editor ...

And i did

  yum upgrade {package name}

As I edited the whole list, I did it continuously ...

Example: yum upgrade sudo nano came mariadb, etc ...

0

what worked for me is :

1) getting the list of duplicated packages : package-cleanup --dupes
2) deleting manually old duplicates : rpm -e --justdb --nodeps {old-version-duplicated-package}
3) yum update

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.