Issue
- How to remove the older versions of a package which has multiple versions installed on Red Hat Enterprise Linux?
- After a failed yum transaction,
yum-complete-transaction
fails to complete and the duplicates are still present.
- yum fails with
<package_name-version1> is a duplicate with <package_name-version2>
- package-cleanup --cleandupes fails with
Error: Depsolving loop limit reached
Resolution
1) Try to complete the transaction
2) Manually remove duplicates
3) Identify remaining rpm corruption
Solution for only RHEL 6,7.
Before manually removing the duplicates, confirm if yum-complete-transaction will resolve the issue.
# yum-complete-transaction
If this completes successfully, so long as there are no further duplicates, you do not need to run the remaining steps.
If there are no duplicates, we can clear this message with the --cleanup-only option
# yum-complete-transaction --cleanup-only
yum check can take quite a while but the output is necessary for these steps
# tar cjf /tmp/rpm_db.tar.bz2 /var/lib/{rpm,yum}
# yum check &> /tmp/yumcheck
# grep "duplicate" /tmp/yumcheck | awk '{ print $NF }' | egrep -v "\:" > /tmp/duplicaterpms
# grep "duplicate" /tmp/yumcheck | awk '{ print $NF }' | egrep ":" | awk -F':' '{ print $NF }' >> /tmp/duplicaterpms
# for i in $(cat /tmp/duplicaterpms); do rpm -e --justdb --nodeps $i; done
# yum update
After removing the Duplicates
If a new kernel was part of the transaction that failed, you may have to reinstall that kernel as well to generate the correct grub entries and initrd/initramfs.
# yum remove kernel-<newversion>-<release>.<arch>
# yum install kernel-<newversion>-<release>.<arch>
Thanks: Harihar Mishra
No comments:
Post a Comment