Yum fix duplicate error
Yum duplicate package error can occur anytime and most of the times when servers are under provisioned in terms of hardware capacity like RAM memory or even CPU. This can happen when a small server needs to perform multiple updates that requires more resources than usual making the update process almost impossible. Of course, failure is not an option and we will do our best to explain in this short tutorial how to fix yum duplicate errors by using yum-utils
utility. So before we start our little journey fixing those yum errors we must say that this solution has been tested on a CentOS 7.5 server and yum
3.4.3 but for sure this can be applied even for older or newer versions unless yum gets really major updates.
Table of contents
Conflict and duplicate errors
Install yum-utils
Fix yum duplicate errors and conflicts
Conflict and duplicate errors
Unfortunately yum updates can fail breaking the update process but luckily there is a fix for these yum errors, below you can see an output where yum errors can be different like package conflicts and even complaining about duplicate packages, all these in just one update process.
...
Error: NetworkManager-glib conflicts with 1:NetworkManager-libnm-1.8.0-9.el7.x86_64
Error: NetworkManager-glib conflicts with 1:NetworkManager-libnm-1.8.0-11.el7_4.x86_64
You could try using --skip-broken to work around the problem
** Found 258 pre-existing rpmdb problem(s), 'yum check' output follows:
ModemManager-glib-1.6.10-1.el7.x86_64 is a duplicate with ModemManager-glib-1.6.0-2.el7.x86_64
1:NetworkManager-1.8.0-11.el7_4.x86_64 is a duplicate with 1:NetworkManager-1.8.0-9.el7.x86_64
1:NetworkManager-1.10.2-16.el7_5.x86_64 is a duplicate with 1:NetworkManager-1.8.0-11.el7_4.x86_64
...
Killed
Install yum-utils
The first step to fix these kind of errors is to install yum-utils
utility package if this is not installed already on our system, this utility comes with two handy tools for fixing yum errors like yum-complete-transaction
and package-cleanup
that we will be using on our next step, if you have this package already installed you can skip this step. So let’s make sure that we have installed yum-utils
on our server first like shown in the example below:
$ yum install yum-utils
Fix yum duplicate errors and conflicts
Having now installed yum-utils
we may proceed fixing all encountered errors. Our next step is to get a list of all duplicate packages that were installed, for this we will be using package-cleanup
that comes as we said before with yum-utils
so let’s run that on our terminal window:
$ package-cleanup --dupes
Next lets try to make sure that all transaction were cleared:
$ yum-complete-transaction --cleanup-only
And finally lets clean up all duplicate packages as show in the example below:
$ package-cleanup --cleandupes
That is all, our short tutorial ends here and now you may try once again to run your yum update
process as usual.