Bug 2395810 - legacy /var/cache/dnf still exists, contains files
Summary: legacy /var/cache/dnf still exists, contains files
Keywords:
Status: CLOSED DUPLICATE of bug 2221663
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 43
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-09-16 14:33 UTC by Chris Murphy
Modified: 2025-09-16 14:56 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-09-16 14:53:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Chris Murphy 2025-09-16 14:33:47 UTC
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

Comment 1 Petr Pisar 2025-09-16 14:44:30 UTC
/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.

Comment 2 Petr Pisar 2025-09-16 14:53:57 UTC

*** This bug has been marked as a duplicate of bug 2221663 ***


Note You need to log in before you can comment on or make changes to this bug.