Question about dnf config on F41 Workstation

Hello.

I was wondering if the

/etc/dnf/dnf.conf

should contain this:

# see `man dnf.conf` for defaults and possible options

[main]

or should it have some config pre-filled by default ?
I’ve seen in some posts/forums, there was something mentioned about having this:

gpgcheck=1

so got me wondering if something is off for me or i am looking in the wrong place ? Also, seen something about dnf now being version dnf5, should i be concerned about previous versions present (dnf4 etc., should i remove them if so) ? Or F41 from the start has only dnf5 without older stuff there ?
Note: I did fresh F41 install (and then i did updates from the ‘software’ app).
Thanks.

Default config is

The defaults are inside the dnf program.

You are expected to only put in the .conf what you are overriding.
The man page will tell you all the settings you can change.

If the dnf.conf had commented out lines for each default setting it would be a messy file and get out of date after a few releases. So its ships in a minimal state.

1 Like

Not sure i understood…isn’t that dnf.conf (in the /etc/dnf/) the ‘default’ config for the dnf program ? If so, for me it is completely empty (there is nothing below the [main]), hence my question above, should it be like that ? :smiley:

Not quite.
The defaults are built into dnf itself.
The dnf.conf file is empty because it relies on the defaults.

Any configs put into dnf.conf act as overrides for the default and changes those specific settings. Unless you need to change how dnf works there should be nothing in the dnf.conf file.

1 Like

Oh, thanks. So, the defaults are in some other file ? Should i even care where those can be seen ? Or i should care only when something will not be working ? :slight_smile:

And making all the settings visible you can with:
dnf --dump-main-config

On what you are looking for, you can filter with grep:
dnf --dump-main-config |grep gpg

My preference I still need to add:
dnf --dump-main-config |grep downloads

4 Likes

and if you want to override any of those, the best practice is to make your own file under /etc/dnf/libdnf5.conf.d/

I make one of my own called “80-user-settings.conf” that contains:

[main]
color=never
color_list_available_downgrade = dim,white
color_list_available_install = dim,white 
color_list_available_reinstall = dim,white 
color_list_available_upgrade = dim,white 
color_list_installed_extra = dim,white 
color_list_installed_newer = dim,white 
color_list_installed_older = dim,white 
color_list_installed_reinstall = dim,white 
color_search_match = dim,white 
color_update_installed = dim,white 
color_update_local = dim,white 
color_update_remote = dim,white 

#local edits
installonly_limit=4
fastestmirror=False
deltarpm=False
excludepkgs=*speech-dispatcher*,kernel-debug*,kernel-uki*

metadata_timer_sync=0
metadata_expire=18005
timeout = 15
minrate = 7000
#
debuglevel = 1
log_size = 10485760
2 Likes

Yes I remember seen that in the Manual too. However till now I not really understood why exactly the directory is called libdnf5 and I am not certain if this changes also will affect dnf while using it with package-kit over Software (gnome) and Discover (KDE)?

The docs between latest and stable say different things.

The plan, as I understand it, is to have all packaging tools use libdnf5.
But at the moment PackageKit has not been ported.

Why it is libdnf5.conf.d and not dnf.conf.d I cannot answer.
Maybe the intention to be able to configure the libdnf algorithms seperate from any specific UI like dnf, but I’m wildly guessing.

1 Like

This is 100% a guess, but a possibility.
Dnf4 uses /etc/dnf/dnf.conf.d. This may be this is to separate the conf files so for those systems that have both versions of dnf installed it would allow for separation of the configs so there is no confict. Systems that were upgraded from f40 or earlier still have dnf4 installed along with the newer dnf5.

Just a speculation on the subject.

1 Like

Ok, this helps me to understand why the different paths. Still not explains why dnf.conf also works with dnf5. At least a strict separation would be with F42 necessary right? And/Or depreciate dnf4 before we do remove it totally from Fedora.

@barryascott is rpm included in packaging tools? Or is it viz-versa that dnf uses rpm? As I understood rpm is not resolving dependencies?

We may ask the Project Discussion/dnf users/developers to get info’s about the schedule and the strict separation of dnf4 & dnf5 configuration files/location. Can I mention this group with an @ or would I have to move it to discussion to make them aware of it?

You can sanity check that a config change made it to “dnf” with:

dnf --dump-main-config

and seeing your changes reflected in the output.

Still not explains why dnf.conf also works with dnf5.

Why wouldn’t /etc/dnf/dnf.conf work with dnf5?; it’s a native file inside the “libdnf5” package

rpm -ql libdnf5 | grep dnf.conf$
/etc/dnf/dnf.conf

1 Like

RPM is the backend for dnf. It is always included.
Rpm does not have the full features that are added by the dnf front end.

Rpm is a lower level then dnf and packagekit. It is not a packaging tool as I am using the term.

Crudely the software stack looks like UI tools depend on libdnf which depend on librpm.

2 Likes

Thanks. I guess i’ll need to understand what all those params and values mean. Btw, why ‘80’ in the file name ? :slight_smile:

In a config folder config fragments are processes in sorted file order.
It is common practice to prefix with 2 digit codes to make the order easy to see and rearrange. Usually gaps are left for inserting more files layer in between.

1 Like

These numbers are for config file ordering and precedence. I.e. if the same parameter configuration is present in 10-smth.conf and 20-smth.conf the latter will overwrite first one. Source

Here an other link about Linux config files in general:

1 Like

n. Btw, why ‘80’ in the file name

Mainly that’s what the “man dnf.conf” manual page says to use for the filename conventions. But really I just have one file in there so it doesn’t really matter. The number makes the loading order obvious if you have more than one.

1 Like