PDA

View Full Version : [SOLVED] yum and dnf clean all



robertdaleweir
23rd August 2015, 09:46 PM
I am using F21 and have used
yum update for most of my updates. I have recently starting using
dnf upgrade. I understand that they both attempt to do similar things and that is fine. My issue is that when I use
yum clean all the system removes all but 12 Megs of space taken up in
/var/cache/yum. When I do a
dnf clean all I am left with over 127 Megs of space under
/var/cache/dnf. Why is there so much stuff left after a
dnf clean all versus
yum clean all?

marko
24th August 2015, 12:09 AM
I've noticed that "dnf clean all" doesn't clean files related to repos that you've defined as not enabled in their respective repo files. That is the ones you have set the the 'enabled' as

enabled=0 down in their *repo file under /etc/yum.repos.d/

Try this:



dnf clean all --enablerepo=\*
I suspect that will make it clean more space as it will override all the enabled=0 flags and
just enable them all. That then makes the "clean all" operate on everything


A handy quick way to see the distribution of file system usage in /var/cache/dnf would be:


du -k --max-depth=1 /var/cache/dnf

robertdaleweir
24th August 2015, 04:22 AM
I've noticed that "dnf clean all" doesn't clean files related to repos that you've defined as not enabled in their respective repo files. That is the ones you have set the the 'enabled' as

enabled=0 down in their *repo file under /etc/yum.repos.d/

Try this:

I suspect that will make it clean more space as it will override all the enabled=0 flags and
just enable them all. That then makes the "clean all" operate on everything


A handy quick way to see the distribution of file system usage in /var/cache/dnf would be:

Thank you Marko. I ran
dnf clean all --enablerepo=\* and it ran fine. There were several repos as you suggested that did not have enabled=1 so they were included in the clean up. The funny thing is there were only a few Megs less than before. I still have over 110 Megs remaining under /var/cache/dnf directory. What would happen if I just cleaned out the entire /var/cache/dnf directory? Would it not regenerate when I run dnf upgrade again?

marko
26th August 2015, 02:12 PM
Thank you Marko. I ran
dnf clean all --enablerepo=\* and it ran fine. There were several repos as you suggested that did not have enabled=1 so they were included in the clean up. The funny thing is there were only a few Megs less than before. I still have over 110 Megs remaining under /var/cache/dnf directory. What would happen if I just cleaned out the entire /var/cache/dnf directory? Would it not regenerate when I run dnf upgrade again?

Why don't you just run

du -k --max-depth=1 /var/cache/dnf

like in post #2 or just look in /var/cache/dnf manually to see what's using the space? (this works okay: "ls -laR /var/cache/dnf" using -R for recursive or "find /var/cache/dnf -type f" )

but yes, it's fine to just remove the /var/cache/dnf directory entirely. DNF will recreate it

You might have "keepcache=1" set in /etc/dnf/dnf.conf that makes it save every rpm you've
ever updated

robertdaleweir
26th August 2015, 05:42 PM
Why don't you just run

du -k --max-depth=1 /var/cache/dnf

like in post #2 or just look in /var/cache/dnf manually to see what's using the space? (this works okay: "ls -laR /var/cache/dnf" using -R for recursive or "find /var/cache/dnf -type f" )

but yes, it's fine to just remove the /var/cache/dnf directory entirely. DNF will recreate it

You might have "keepcache=1" set in /etc/dnf/dnf.conf that makes it save every rpm you've
ever updated

Thank you Marko. One last question if I might. I notice that PackageKit has a fair number of RPMs stored within its directories, can this directory also be removed in like manner to the DNF directory? In essence to empty all directories under /var/cache/ (but leaving the /var/cache/ directory) should not harm anything except updating, isn't that true?