Can we clean yum cache files manually?

Posted on

Problem :

I am using Redhat 7 while running yum update I am getting Bus error (core dumped) error.

After troubleshooting I found that / was full because of /var/cache/yum/x86_64/7server/rhel-x86_64-server-7/gen folder.

Inside this folder below files contains GB of data.

enter image description here

I tried yum clean all command to clean up the space but it is not working.

Can I manually delete these files?

Manual delete will cause any problem to yum ?

Solution :

After successful installation, packages should be deleted from the yum cache.
You should check in the file /etc/yum.conf, whether the keepcache setting
is 1 instead of 0.

The RedHat post
Maybe you want: rm -rf /var/cache/yum
says that
the command yum clean all gives the impression that enabled and disabled/removed
repos are cleaned but in reality, performs only these tasks:

  • clean all cache from enabled repos
  • remove all data from unknown repos
  • preserve cache of disabled/removed repos

The fix in
RHBA-2017:2295
should have added a reminder for this command saying:

Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos

In any case, whatever your situation, you can issue the recommended command:

rm -rf /var/cache/yum

Manual deletion is quite safe and will not cause problems with yum. This is fine:

rm -rf /var/cache/yum

You can also check this post on other steps that may help in clearing disk space.

Leave a Reply

Your email address will not be published. Required fields are marked *