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:

yum update

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-22.el7.centos.2 will be updated
--> Processing Dependency: ntpdate = 4.2.6p5-22.el7.centos.2 for package: ntp-4.2.6p5-22.el7.centos.2.x86_64
---> Package ntpdate.x86_64 0:4.2.6p5-25.el7.centos will be an update
--> Finished Dependency Resolution
Error: Package: ntp-4.2.6p5-22.el7.centos.2.x86_64 (@updates)
           Requires: ntpdate = 4.2.6p5-22.el7.centos.2
           Removing: ntpdate-4.2.6p5-22.el7.centos.2.x86_64 (@updates)
               ntpdate = 4.2.6p5-22.el7.centos.2
           Updated By: ntpdate-4.2.6p5-25.el7.centos.x86_64 (base)
               ntpdate = 4.2.6p5-25.el7.centos
 You could try using --skip-broken to work around the problem
** Found 30 pre-existing rpmdb problem(s), 'yum check' output follows:
1:NetworkManager-1.0.6-31.el7_2.x86_64 has missing requires of NetworkManager-libnm(x86-64) = ('1', '1.0.6', '31.el7_2')
1:NetworkManager-1.4.0-13.el7_3.x86_64 is a duplicate with 1:NetworkManager-1.0.6-31.el7_2.x86_64
audit-2.4.1-5.el7.x86_64 has missing requires of audit-libs = ('0', '2.4.1', '5.el7')
audit-2.6.5-3.el7.x86_64 is a duplicate with audit-2.4.1-5.el7.x86_64
binutils-2.25.1-22.base.el7.x86_64 is a duplicate with binutils-

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:

yum install yum-utils

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

package-cleanup --dupes

Loaded plugins: fastestmirror

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.

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at and