Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate Package - update / upgrade - Centos

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.

like image 953
Justin Avatar asked Oct 17 '13 04:10

Justin


People also ask

How do I remove duplicate packages in Linux?

You can remove the duplicates by using rpm -e --justdb --nodeps $newerpackage - using the example from above, that would be rpm -e --justdb --nodeps nss-tools-3.28. 4-15. el7_4. x86_64 grub2-common-2.02-0.65.

How do I upgrade a specific package in Centos?

When you run the yum update , all system packages with available updates are updated. However, if you want to upgrade a single package, then you would have to pass the package name as the argument to the yum update command. Replace the <packagename> with the name of the specific package you want to update.

What is package cleanup?

package-cleanup is a program for cleaning up the locally-installed RPMs.

Does YUM update install packages?

YUM is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux. YUM performs dependency resolution when installing, updating, and removing software packages. YUM can manage packages from installed repositories in the system or from .


2 Answers

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.

like image 75
user1403360 Avatar answered Sep 22 '22 13:09

user1403360


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.
like image 38
Guilherme Monteiro Avatar answered Sep 22 '22 13:09

Guilherme Monteiro