Something went awry this weekend while installing updates for my CentOS server. Using the standard ‘yum update’ command for the yum package manager, there were suddenly a large number of updates to install. I should not have approved them but what do I know compared to the package manager. Foolishly, I proceeded with the updates. Upon its completion, yum began complaining of duplicate packages.
The fast solution to my problem was running this command to clean up the duplicates:
If that had been unable to resolve the problem (and honestly, the direction I started working first) I got a list of the duplicate packages with the package-cleanup -dupes command. I then told the latest package to think it was not installed. I then invoked a Yum update and confirmed the reinstall of the latest version of that package. My input was as below:
package-cleanup --dupes rpm -e --justdb nspr-4.11.0-0.1.el6_7.x86_64 yum update -y
In case of dependencies, you might need to mark more than one package, and in the right order. You will receive this error when you try to mark a package that has other dependencies.
“[packagename] is needed by (installed) [packagedependency]”
Handle the dependencies first and then the package you tried. List the dependency as not installed and then the original package. So in this case:
rpm -e --justdb elfutils-libs-0.164-2.el6.x86_64 rpm -e --justdb elfutils-libelf-0.164-2.el6.x86_64 yum update -y
This process was pretty easy to follow and resolve the duplicate warnings. I would update my list of duplicated packages and work my way through them. Although it was time-consuming to follow the manual method, I was making good progress before the package-cleanup -cleandupes took care of everything in one fell swoop.