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.
Here’s the output:
yum update Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.sonn.com * extras: repo1.sea.innoscale.net * updates: mirror.n5tech.com 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-184.108.40.206.1-55.el7.x86_64 ...
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 parted-3.1-23.el7.x86_64 parted-3.1-28.el7.x86_64 tar-1.26-29.el7.x86_64 tar-1.26-31.el7.x86_64 kexec-tools-2.0.7-38.el7_2.1.x86_64 kexec-tools-2.0.7-50.el7.x86_64 rsyslog-7.4.7-12.el7.x86_64 rsyslog-7.4.7-16.el7.x86_64 NetworkManager-1.0.6-31.el7_2.x86_64 NetworkManager-1.4.0-13.el7_3.x86_64 irqbalance-1.0.7-6.el7.x86_64 irqbalance-1.0.7-5.el7.x86_64 ntp-4.2.6p5-25.el7.centos.x86_64 ntp-4.2.6p5-22.el7.centos.2.x86_64 xinetd-2.3.15-13.el7.x86_64 xinetd-2.3.15-12.el7.x86_64 wget-1.14-10.el7_0.1.x86_64 wget-1.14-13.el7.x86_64
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.