How to remove yum duplicates

Modified on Fri, 2 Aug at 1:32 PM

In rare occassions you may have an error such as "is a duplicate with". In such case, you will need to remove the duplicates from yum. Here is an example error in yum:

yum-3.4.3-158.el7.centos.noarch is a duplicate with yum-3.4.3-154.el7.centos.1.noarch
yum-plugin-fastestmirror-1.1.31-45.el7.noarch is a duplicate with yum-plugin-fastestmirror-1.1.31-42.el7.noarch

NOTE As always, create a backup before running the commands below.

Make sure that you have yum-utils installed before you continue:

yum install yum-utils -y

The following command resolves this issue:

package-cleanup --cleandupes

Depending on your situation, you may get the following error:

Warning: Some duplicates were not removed because they are required by installed packages.
You can try —cleandupes without --removenewestdupes, or review them with --dupes and remove manually.

To resolve this, execute the following command:

package-cleanup --cleandupes --removenewestdupes

If this command still shows errors, you can try to reinstall the packages. Replace packagename with the actual packagename you want to reinstall.

yum reinstall packagename

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article