TLDR:
yum clean all
== clean mostrm -rf /car/cache/yum/*
== really clean everything
From the man page:
Note that these commands only operate on files in currently enabled
repositories. If you use substitution variables (such as $releasever) in your cachedir configuration, the operation is further restricted to the current
values of those variables.
The main take away from this is that yum clean all
doesn't touch disabled repos. It also leaves behind some urlgrabber metadata.
[root@110aca4d5660 /]# yum makecache > /dev/null
[root@110aca4d5660 /]# yum-config-manager --disable extras > /dev/null
[root@110aca4d5660 /]# yum --verbose clean all
Loading "fastestmirror" plugin
Loading "ovl" plugin
Config time: 0.007
rpmdb time: 0.000
ovl: Copying up (0) files from OverlayFS lower layer
Yum version: 3.4.3
Cleaning repos: base updates
Operating on /var/cache/yum/x86_64/7 (see CLEAN OPTIONS in yum(8) for details)
Cleaning up list of fastest mirrors
Disk usage of /var/cache/yum/*/* after cleanup:
0 enabled repos
2.7 M disabled repos:
2.7 M /var/cache/yum/x86_64/7/extras
0 untracked repos
166 other data:
166 /var/cache/yum/x86_64/7/timedhosts
2.7 M total
[root@110aca4d5660 /]# find /var/cache/yum/ -type f
/var/cache/yum/x86_64/7/extras/gen/primary_db.sqlite
/var/cache/yum/x86_64/7/extras/gen/filelists_db.sqlite
/var/cache/yum/x86_64/7/extras/gen/other_db.sqlite
/var/cache/yum/x86_64/7/extras/repomd.xml
/var/cache/yum/x86_64/7/extras/mirrorlist.txt
/var/cache/yum/x86_64/7/extras/6b73f11e41f6efe0b6f51489c859e1ec0e526a75a8cd082c5040b4bc0950165e-filelists.sqlite.bz2
/var/cache/yum/x86_64/7/extras/1f4b7c95a68d523c8ac486be0e2f024dacbc1efb0a570545c32bbf3f5f4b80be-other.sqlite.bz2
/var/cache/yum/x86_64/7/extras/4e72f00067036f7cc3d1c01071a0f80f1ca5cb4fe19ee225a766e50912179ab6-primary.sqlite.bz2
/var/cache/yum/x86_64/7/extras/cachecookie
/var/cache/yum/x86_64/7/timedhosts
As you can see, the extras metadata was left behind because the repo was disabled. The timedhosts file is that urlgrabber metadata I mentioned (related bug).
Similarly in DNF, some extra metadata is left behind after a dnf clean all
. DNF's verbose flag doesn't show the same breakdown as yum when you clean, but you can still list the files afterwards.
<carl@artanis:~>$ podman run -it --rm ubi8/ubi
bash-4.4# dnf makecache > /dev/null
bash-4.4# dnf --verbose clean all
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
DNF version: 4.0.9
cachedir: /var/cache/dnf
Cleaning data: metadata packages dbcache
16 files removed
bash-4.4# find /var/cache/dnf/ -type f
/var/cache/dnf/packages.db
/var/cache/dnf/expired_repos.json
/var/cache/dnf/ubi-8-appstream-93da5dec0ae7578d/repodata/a0bb858fadc55492b39fa173a9f4d401cac748fc3b1db567b514bb865087869a-modules.yaml.gz
When in doubt, just nuke the whole cache.