Wednesday, January 28, 2015

Yum Update and Duplicate Packages


So you try to do a yum update on CentOS or Fedora and get a list of duplicate packages.
(xxx is a duplicate of xxx)

What can happen is for some reason, you have indeed, duplicate packages installed.
One old version and one newer.

To solve this issue, you need to remove the older duplicate packages and keep the newer
$yum check duplicates | awk '/is a duplicate/ {print $6}' > /tmp/DUPES

This will create a list of the older duplicate packages in the /tmp/DUPES file
Review the /tmp/DUPES to be sure what will be removed

$yum remove `cat /tmp/DUPES`
*Note: when it happened to me on CentOS 6.6, the dependecies to be removed were allot
and included "yum" itself... The total of files to be removed was a whopping 1.1G.

Although it appears scary, because you want to remove lets say 10 duplicate packages but the resolved dependencies are like 100, there is no reason for alarm, it works as intended...

The duplicate older packages got removed and after that I could perform the yum update without issues.
So, a tried and tested method for a safe duplicate packages removal, up to CentOS 6.6

The original author also mentions the command:
$package-cleanup --cleandupes

But it's not recommended and I haven't tested it myself.
Better do it manually and have more control of what happens, than let it run by itself...

No comments:

Post a Comment