Maybe you want: rm -rf /var/cache/yum

Latest response

I am a little surprised to see the following message when you issue 'yum clean all' with the most recent version of yum in RHEL 7.4.

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

Rather than implementing a code fix which cleans up /var/cache/yum completely (for disabled and orphaned repos), yum is suggesting to the root user to execute 'rm' with 'recursive' and 'force' options???

Bugzilla is here:
https://bugzilla.redhat.com/show_bug.cgi?id=1357083

Errata is here:
https://access.redhat.com/errata/RHBA-2017:2295

Responses

Thanks PixelDrift. Came across that and thought yum clean all shouldn't be doing that. Good it's fixed.

Hi Sam,

What is fixed ? I still get this message after executing sudo yum clean all on my RHEL 7.4 Server systems.

Regards,
Christian

Yes, it is not yet fixed. I could see that with latest updated yum package it is still throwing that message.

I guess the ironic thing is that Red Hat treat this message being displayed as 'the fix'.

That is true, they have added the hint message which is there in changelog:

- Add hint about rm -rf for yum clean all. 

But as per this RHBA-2017:2295 it should rather clean up the repos of inactive as well.

BZ - 1357083 - yum clean all does clean up cache from earlier configured and not enabled now repositories

This was my guess from the beginning after I saw the message the first time, displayed intentionally.
sudo yum clean all indeed doesn't clean the entire cache (and I have checked this several times).
Hence it is necessary to execute sudo rm -rf /var/cache/yum in order to clean the 'whole' cache.

Yes, this statement is rather contradicting here:

BZ - 1357083 - yum clean all does clean up cache from earlier configured and not enabled now repositories

Which otherwise must be modified properly.

Hi Christian,

I think yum clean all is not properly understood. Without referring to the man page, it can give the impression that enabled and disabled/removed repos are cleaned but in reality, performs 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 adds a note without being too verbose - to remind users that yum clean all does not clean disabled/removed repos.

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

Disabled/removed repos cache is preserved and a user must specify rm -rf /var/cache/yum in order to remove that data - as per man page.

# man yum

CLEAN OPTIONS
       The following are the ways which you can invoke yum in clean mode. Note that "all files" in the commands below means "all  files  in  cur‐
       rently enabled repositories".  If you want to also clean any (temporarily) disabled repositories you need to use --enablerepo='*' option.

Thanks for clarification Sam ! :)

Regards,
Christian

The problem is, this is a weak solution.

A tool should never be instructing users to execute a recursive rm (with the force tag no less). The tool should manage this function internally. As it stands, the tool itself can't clean up after itself (easily), which is broken. Having to re-enable repos, to clean a local cache is broken (what if the remote repo is gone?)

This capability doesn't necessarily need to be provided by 'yum clean all', but I believe it should, as 'all' to any end user suggests 'everything' which is why Red Hat get constant and repeated questions about why this command doesn't function as people expect.

Detailing in the man page, or adding a note to run 'rm -rf' doesn't resolve the root issue. There should be a sane and straightforward way in the yum tool to clean up all yum cache entities.

Another example of this kind of ridiculousness is the 'realm' tool, which informs the end user that they are joined to an AD domain when they aren't... the solution? Manually delete the kerberos keytab and move all the configuration files... really?
https://access.redhat.com/solutions/2776361

Well, I didn't know that sudo yum clean all wouldn't clean the whole cache, too. And I agree that it should do the job. Would there be any disadvangage if sudo yum clean all works as expected?

No Jörg,

When you remove the cache, after the next run of yum update it gets recreated with the enabled repositories.
Just temporarily disabled repos have to re-enabled of course - so no real disadvantage in cleaning the cache. :)

Regards,
Christian

Well, maybe then all it needs is a request for feature enhancement!? But I understand from the bugzilla that there are some people who need the cache to stay intact, too.

Hi Jörg,

I think that in the end it isn't a "really serious issue" and when we want to rebuild the cache, now we know that we'll just have to execute this command ... which is not "too much effort" in my opinion. :)

Regards,
Christian

Hi Christian,

Well, that's a lot of additional typing to do. But I think we can handle it. ;-P We could type it several times before we reach the amount of keystrokes it takes to write a RFE. :-)

Best regards, Joerg

HaHaHa ... good one ... nice to see some humor appearing here in our community ... cool Jörg ! :D
But jokes aside, normally it isn't necessary to cleanup. How often do we enable or disable repos ?
Not often - right ? Once everything is setup, we can keep the cache as it is, so not too much work.

Cheers :)
Christian