/etc/dnf doesn't exist

I just posted another thread about my boot partition being full and the reply said that I could change some of the settings for what is retained in /boot by editing /etc/dnf/dnf.conf. But I don’t seem to have a /etc/dnf directory in this system at all. Any explanation about why this would be missing from a pretty standard fresh install?

Rocky 9.5 Cinnamon desktop

/etc/dnf should not be missing in normal installations. It is owned by dnf-data. The directory was either removed intentionally or the package was somehow removed.

I wonder how that affects DNF?


Normally, one can ask with dnf which packages provide a feature or file. For example:

# dnf provides /etc/dnf 
Last metadata expiration check: 2:13:43 ago on Thu 06 Mar 2025 08:02:17 AM EET.
dnf-data-4.14.0-17.el9.alma.1.noarch : Common data and configuration files for DNF
Repo        : @System
Matched from:
Filename    : /etc/dnf

dnf-data-4.14.0-17.el9.alma.1.noarch : Common data and configuration files for DNF
Repo        : baseos
Matched from:
Filename    : /etc/dnf

tells that the directory /etc/dnf is provided by package dnf-data, which is in repository baseos and is installed (“@”), probably by the installer (“System”).
A look with dnf history list dnf-data confirms that the package was installed first time in transaction 1, (done by installer). if package were since removed, the history should still show when.

Since I have the package installed, I can verify the files it provides with:

# rpm -V dnf-data
..5....T.  c /etc/dnf/dnf.conf

That output reveals that I have modified config file /etc/dnf/dnf.conf.

More verbose verify and other commands can list all the files in the package:

rpm -Vv dnf-data
rpm -ql dnf-data
dnf rq -l dnf-data

The last of them works on package even when it is not installed.

One can run the verify check on all installed packages with rpm -Va
That does always list some modified files.

If package is installed, then one can force reinstall with

dnf reinstall dnf-data

Hmm. Here’s what I’m seeing with a couple of those commands.

[chmedly@localhost ~]$ rpm -V dnf-data
.M.......  g /var/lib/dnf
.M.......  g /var/log/dnf.librepo.log
.M.......  g /var/log/dnf.log
.M.......  g /var/log/dnf.rpm.log
[chmedly@localhost ~]$ dnf history list dnf-data
ID     | Command line                                                   | Date and time    | Action(s)      | Altered
---------------------------------------------------------------------------------------------------------------------
     1 |                                                                | 2024-11-16 01:23 | Install        | 1420 EE

Wait! What the…
I just tried to cd to /etc/dnf and what do you know? It’s there.
I tried from a couple different terminals and file browsers (both on the machine and remotely from cockpit) before and it simply wasn’t showing. I’m losing my mind…

Thanks everyone.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.