Last Updated: February 25, 2016
· jabclab

Resolving yum errors after out of memory error

When performing a yum update -y I ran into an out of memory exception.

After this occurred (I had to run yum-complete-transaction) I was seeing the following error when performing the update:

--> Finished Dependency Resolution
Error: Package: coreutils-libs-8.4-31.el6_5.1.x86_64 (@updates)
           Requires: coreutils = 8.4-31.el6_5.1
           Removing: coreutils-8.4-31.el6_5.1.x86_64 (@updates)
               coreutils = 8.4-31.el6_5.1
           Updated By: coreutils-8.4-31.el6_5.2.x86_64 (updates)
               coreutils = 8.4-31.el6_5.2
           Available: coreutils-8.4-31.el6.x86_64 (base)
               coreutils = 8.4-31.el6
 You could try using --skip-broken to work around the problem

This was resolved by running the following:

sudo sh -c 'for file in `rpm -qa --queryformat="%{NAME} %{ARCH}\n" | sort | uniq -c | grep -v " 1 " | cut -c 9- | cut -d" " -f1`; do rpm -q --last $file | head -1 | cut -d" " -f1; done | grep -v kernel | grep -v gpg-pubkey | xargs rpm -e --justdb —nodeps'

Thanks to @toracat in the CentOS forums.