Bug 2216905

Summary: dnf5 seems to ignore cachedir=
Product: [Fedora] Fedora Reporter: Valdis Kletnieks <valdis.kletnieks>
Component: dnf5Assignee: Nicola Sella <nsella>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: jkolarik, nsella, pkratoch, rpm-software-management
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Valdis Kletnieks 2023-06-23 06:32:23 UTC
/etc/dnf/dnf.conf contains:

# cat /etc/dnf/dnf.conf
[main]
cachedir=/usr/src/dnf/$basearch/$releasever
gpgcheck=True
installonly_limit=3
keepcache=1


However, it decided to download the RPM to /var/cache/libdnf5 anyhow:

# find /var /usr/src/dnf -name '*8.99.76.300-1*' -ls
      800 123056 -rw-r--r--   1 root     root     125999500 Jun 23 01:41 /var/cache/libdnf5/skype-unstable-2948e6a06613a3cd/packages/skypeforlinux_8.99.76.300-1.x86_64.rpm


Reproducible: Always

Comment 1 Nicola Sella 2023-07-10 09:17:26 UTC
Hi, can you please specify dnf5's version and on which fedora, so I can test it?

Comment 2 Jan Kolarik 2023-07-13 11:30:09 UTC
I think this is due to using dnf from the root account. Then by default system cachedir is used. See https://github.com/rpm-software-management/dnf5/blob/5.0.15/libdnf5/conf/config_main.cpp#L1424.

Comment 3 Valdis Kletnieks 2023-07-16 13:25:22 UTC
(In reply to Nicola Sella from comment #1)
> Hi, can you please specify dnf5's version and on which fedora, so I can test
> it?

Running Rawhide.

Is currently happening on dnf5-5.0.15-4.fc39.x86_64, but it appears to have been broken since 5.0.14-1.

Comment 4 Valdis Kletnieks 2023-07-16 13:40:28 UTC
(In reply to Jan Kolarik from comment #2)
> I think this is due to using dnf from the root account. Then by default
> system cachedir is used. See
> https://github.com/rpm-software-management/dnf5/blob/5.0.15/libdnf5/conf/
> config_main.cpp#L1424.

I'm OK with it using that directory as the *default*,  the fact I specified a cachedir=
in dnf.conf and it didn't honor it is what bothers me.. /var fills up pretty fast if
you also have 'keepcache=1' (I've been burned too many times with rawhide updates
that I need to backlevel and I can't find the previous version).  Add in a few
repos like google-chrome-beta and google-chrome-unstable and the next thing you know
your cachedir is growing at a gigabyte a week (which is why I intentionally pointed it
at a filesystem that's currently sitting at 835G free...)

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