I notice with upgraded systems that /var/cache/dnf still exists, and it contains old crusty bits. dnf5 uses /var/cache/libdnf5, so /var/cache/dnf is just going stale, taking up space, could (speculatively) cause issues for PackageKit (see bug https://bugzilla.redhat.com/show_bug.cgi?id=2372978#c9) I think the dnf5 RPM should probably clean this up on behalf of the old version? Reproducible: Always Steps to Reproduce: I've noticed this on systems (major version) upgraded using dnf, and gnome-software Actual Results: /var/cache/dnf still exists and contains significant amount of files Expected Results: /var/cache/dnf should not exist or be empty
/var/cache/dnf is used by DNF4 (python3-dnf package). Regarding removing its content, it could be done when uninstalling python3-dnf with a postun scriptlet. But there is a problem that DNF4 has no idea which files there were created by DNF4 which files were saved there by someone else. In RPM world, the "best" practice is not to touch files the RPM package does not own. I.e. keep the cruft there for system administrator's discretion. AFAIK in the past there was (unrelated to DNF) cron job which scanned /tmp and removed long time unused files. That cron job would the best solution for these cache files. But I worry it does not exist anymore.
*** This bug has been marked as a duplicate of bug 2221663 ***