How to remove duplicate packages with yum

I’m working on a handful of servers that all have the same problem: when running yum, an error message appears that tells me a package called ntpupdate needs to be upgraded, but somehow this doesn’t work and the package is being skipped. Then follows a huge list of duplicate packages that are installed on those systems (probably installed by the automatic package updater within Plesk).

Let’s see how we can fix such issues.

The Problem

Here’s the output:

The list goes on. The solution: remove the duplicate packages and start again!

The Solution: Removing duplicate packages

First we need to install something called yum-utils. It’s as easy as this:

Next we’ll display a list of which packages exist more than once on our server. No changes are being made just yet:

To remove the oldest versions of all duplicate packages, we’ll issue the package-cleanup –cleandupes command. The output that follows looks almost identical to that of a yum update command, except that things are being erased rather than updated.

When the process has finished, we can use yum update again without trouble.

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs several YouTube channels and websites, and he's also live on Twitch sometimes. To support him on his mission to make the world a better place, you can support him on Patreon or buy him a coffee.

2 thoughts on “How to remove duplicate packages with yum

  1. Thanks for the information above. And this solves my problem described below:

    I have the situation that the server is experiencing problems with duplicate packages in the Yum update.
    How to solve this in a way that does not have to cause a stop, or that causes a problem in the server, since it is an internet server, proxy and email …
    Until I found something, but they are very old postings, so I am in doubt if they still apply to the current version of CentOS 7.5.1804 and there is no information if it can cause a problem if I have the risk of removing some package and or configuration in use, and cause the system shutdown, or other serious problem.

    Here’s the situation in .txt file in Google Drive:

    Thanks in advance.

Leave a Reply to Jean Koepsel Cancel reply