Bug 2332856

Summary: /var/lib/dnf has no owner.
Product: [Fedora] Fedora Reporter: Fxzx micah <fxzxmicah>
Component: dnf5Assignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 41CC: daniel.mach, jkolarik, jmracek, jrohel, mblaha, nsella, packaging-team-maint, pkratoch, ppisar, rpm-software-management
Target Milestone: ---Keywords: Patch, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: dnf5-5.2.8.1-4.fc42 dnf5-5.2.8.1-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-11 01:42:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fxzx micah 2024-12-17 16:12:20 UTC
/var/lib/dnf has no owner.

ls -l /var/lib/dnf/
total 7028
-rw-r--r--. 1 root root 1527808 Dec 17 19:49 history.sqlite
-rw-r--r--. 1 root root   32768 Dec 17 19:49 history.sqlite-shm
-rw-r--r--. 1 root root 5632072 Dec 15 02:03 history.sqlite-wal
drwxr-xr-x. 1 root root      94 Nov  2 21:41 repos


Reproducible: Always

Comment 1 Petr Pisar 2024-12-17 16:29:52 UTC
/var/lib/dnf directory in Fedora 42 is by dnf-data-4.22.0-1.fc42.noarch package which is built from dnf component. Moving this bug report to that component.

Comment 2 Fxzx micah 2024-12-17 16:34:39 UTC
But for dnf5 only systems, dnf-data is not needed.

Comment 3 Petr Pisar 2024-12-17 16:49:41 UTC
I'm not sure whether DNF5 uses that directory for anything than importing DNF4 history into DNF5.

Comment 4 Fxzx micah 2024-12-17 17:00:44 UTC
Directory where DNF5 stores its persistent data between runs.
Default: ``/var/lib/dnf``.

I saw this description from the source code.

Comment 5 Petr Pisar 2024-12-17 17:07:09 UTC
That can be leftover from DNF4 sources.

DNF5 sources refer /var/lib/dnf on few places:

$ git grep '/var/lib/dnf'
doc/dnf5.8.rst:    /var/lib/dnf/
doc/dnf5.conf.5.rst:    Default: ``/var/lib/dnf``.
include/libdnf5/conf/const.hpp:constexpr const char * PERSISTDIR = "/var/lib/dnf";
libdnf5/transaction/Swdb.cpp:        // extract persistdir from path - "/var/lib/dnf/"
libdnf5/transaction/Swdb.hpp:    static constexpr const char * defaultPath = "/var/lib/dnf/history.sqlite";
libdnf5/transaction/Transformer.cpp: * \param inputDir directory to load data from (e.g. `/var/lib/dnf/`)

But most of them are dead code.

It also constructs that path manually on other places. I will need a help from more knowledgeable DNF5 developers.

But you are right that will be safer to track this issue in DNF5. There is not much we could do in DNF4 package as Fedora has a history of preserving unowned files indefinitely.

Comment 6 Fxzx micah 2024-12-17 17:22:18 UTC
Then it's all up to you, I don't have enough knowledge about this, either. :)

Comment 7 Petr Pisar 2024-12-19 14:37:29 UTC
We found that directory is still used by DNF5 for countme feature (a cookie reported to a Fedora mirror manager). We will fix DNF5 to own that directory.

Comment 8 Fxzx micah 2024-12-19 15:53:10 UTC
So /var/lib/dnf/[history.sqlite history.sqlite-shm history.sqlite-wal] is actually useless in dnf5?

Comment 9 Petr Pisar 2024-12-19 16:10:55 UTC
Those files are read on first dnf5 run. Later on they are useless for dnf5.

Comment 10 Petr Pisar 2025-01-07 12:26:59 UTC
Merged upstream.

Comment 11 Fedora Update System 2025-01-09 12:46:45 UTC
FEDORA-2025-f3bc917e71 (dnf5-5.2.8.1-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-f3bc917e71

Comment 12 Fedora Update System 2025-01-10 03:12:02 UTC
FEDORA-2025-f3bc917e71 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-f3bc917e71`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-f3bc917e71

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2025-01-11 01:42:37 UTC
FEDORA-2025-f3bc917e71 (dnf5-5.2.8.1-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.