Bug 2221663 - Uninstalling dnf leaves /var/cache/dnf with files there
Summary: Uninstalling dnf leaves /var/cache/dnf with files there
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jaroslav Rohel
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2395810 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-10 14:53 UTC by Vít Ondruch
Modified: 2025-09-16 14:53 UTC (History)
11 users (show)

Fixed In Version:
Clone Of: 2216849
Environment:
Last Closed: 2024-11-27 21:14:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Vít Ondruch 2023-07-10 14:53:06 UTC
This is follow up of #2216849 where apart of wrong directory ownership, I have complained about leaving old stuff behind. Nobody bothered to answer.

BTW these are precisely the issues I was afraid when I was pointing that DNF5 is wrong name and idea and DNF should keep the DNF name (together with e.g. bug 2216850). It is sad that this happens :( I can't see nothing "right" about this migration.




+++ This bug was initially created as a clone of Bug #2216849 +++

~~~
$ ll /var/cache/dnf
total 236812
drwxr-xr-x. 1 root root       16 Feb 24  2021 commandline-e5106bc4577995c5
drwxr-xr-x. 1 root root       16 Nov  6  2020 commandline-f24b2296296d9941

... snip ...


$ rpm -qf /var/cache/dnf
file /var/cache/dnf is not owned by any package

$ ll /var/cache/libdnf
total 0

$ rpm -qf /var/cache/libdnf
libdnf5-5.0.14-1.fc39.x86_64

$ ll /var/cache/libdnf5/
total 0
drwxr-xr-x. 1 root root 24 Jun 22 22:17 copr:copr.fedorainfracloud.org:atim:shortwave-0753e68d23b426e2
drwxr-xr-x. 1 root root  0 Jun 22 22:17 copr:copr.fedorainfracloud.org:minzord:MinzRepo-0d8ed193db788372
drwxr-xr-x. 1 root root 24 Jun 22 22:17 copr:copr.fedorainfracloud.org:vondruch:doublecmd-6e0d024f0675de55
drwxr-xr-x. 1 root root 24 Jun 22 22:17 flexibee-933c35cd256edfab
drwxr-xr-x. 1 root root 48 Jun 22 22:17 rawhide-2d95c80a1fa0a67d
drwxr-xr-x. 1 root root 48 Jun 22 22:17 rpmfusion-free-rawhide-11a4e834e18e3a11
drwxr-xr-x. 1 root root 48 Jun 22 22:17 rpmfusion-free-tainted-756867963ab562f2
drwxr-xr-x. 1 root root 48 Jun 22 22:17 rpmfusion-nonfree-rawhide-978ef37952204a2d
drwxr-xr-x. 1 root root 48 Jun 22 22:17 rpmfusion-nonfree-tainted-1fa5052018c68452

$ rpm -qf /var/cache/libdnf5/
file /var/cache/libdnf5 is not owned by any package
~~~

BTW I also don't understand why `/var/cache/dnf` is not either used or removed after (forced) update to dnf5

Reproducible: Always

--- Additional comment from Petr Pisar on 2023-06-26 16:31:26 CEST ---

/var/cache/libdnf5 is only used by DNF5.
/var/cache/libdnf is used neither by DNF5, nor DNF4.
/var/cache/dnf directory is only used by DNF4.

You are right that libdn5 package should own /var/cache/libdnf5 instead of /var/cache/dnf. This has been fixed in upstream fives days ago <https://github.com/rpm-software-management/dnf5/commit/f33e35aadbd1b71d0ff8d6f4ec36493db9ee3ead>. I guess this will be addressed in a next Fedora build.

I guess /var/cache/dnf was left orphaned on your system after uninstalling dnf. Keeping nonempty directories is a standard RPM behavior. Removing that tree could be achieved with an RPM postuninstallation script, but this is not a typical approach used in Fedora. The files are usually kept there for case a user would install the package again.

--- Additional comment from Vít Ondruch on 2023-06-28 11:28:27 CEST ---

(In reply to Petr Pisar from comment #1)
> I guess /var/cache/dnf was left orphaned on your system after uninstalling
> dnf. Keeping nonempty directories is a standard RPM behavior. Removing that
> tree could be achieved with an RPM postuninstallation script, but this is
> not a typical approach used in Fedora. The files are usually kept there for
> case a user would install the package again.

I am not sure if the cache directory content was changed, but:

1) I would expect that the same directory is still used.
2) If that is not possible due to format change, then I'd expect that the data are migrated.

It might not sound useful, but running Rawhide, the cache might be the most convenient place to get the older version of package which used to work. I think I have proposed somewhere, that DNF should consider the cache for updates/downgrades, which unfortunately was not implemented (yet). But this is out of scope of this ticket.

--- Additional comment from Jaroslav Mracek on 2023-06-28 12:35:15 CEST ---

Changing status to post because the issue is fixed in upstream. See comment 1. The patch will be released next week.

--- Additional comment from Vít Ondruch on 2023-06-28 13:16:48 CEST ---

(In reply to Jaroslav Mracek from comment #3)
> Changing status to post because the issue is fixed in upstream. See comment
> 1. The patch will be released next week.

Sorry, but:

1) The upstream fix will leave behind yet another directory
2) I have provided more thought on this topic. Could you please elaborate? Is the cache compatible or not? Can it be reused?

--- Additional comment from Pavla Kratochvilova on 2023-06-29 18:11:42 CEST ---

Sorry, I can't answer your questions, Vít, but the aforementioned patch is part of bodhi update https://bodhi.fedoraproject.org/updates/FEDORA-2023-3f321278b5
(I didn't realize that for releases which haven’t yet reached the activation point, bugs can be associated to bodhi updates only by adding keywords to the changelog in the build, and not after that, so, I will handle this manually.)

Comment 1 Vít Ondruch 2023-07-10 15:33:22 UTC
I don't necessarily agree with the move to DNF. I have asked this question. Let me quote my concern:

> I am not sure if the cache directory content was changed, but:
>
> 1) I would expect that the same directory is still used.
> 2) If that is not possible due to format change, then I'd expect that the data are migrated.
>
> It might not sound useful, but running Rawhide, the cache might be the most convenient place to get the older version of package which used to work. I think I have proposed somewhere, that DNF should consider the cache for updates/downgrades, which unfortunately was not implemented (yet). But this is out of scope of this ticket.

I am afraid that the solution in the context of DNF will be "just delete the directory", which should not be the primary solution IMHO.

Comment 2 Fedora Release Engineering 2023-08-16 08:12:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 3 Aoife Moloney 2024-11-08 10:55:11 UTC
This message is a reminder that Fedora Linux 39 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 39 on 2024-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '39'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 39 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Aoife Moloney 2024-11-27 21:14:59 UTC
Fedora Linux 39 entered end-of-life (EOL) status on 2024-11-26.

Fedora Linux 39 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 5 Petr Pisar 2025-09-16 14:53:57 UTC
*** Bug 2395810 has been marked as a duplicate of this bug. ***


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