DNF updates repository cache whenever I try to install a package


Hi all,

I really like using the DNF package manager however I have one annoyance with it. Whenever I want to run an arbitrary install command, it randomly refreshes the repository cache.

For example, I might run “$ dnf install ” and then it will either bring up the package instantly and prompt me to install “[y/N]” or it will update repositories and then prompt me to install. When it keep resolving the repositories, it makes installing basic packages a nuisance. The screenshot below shows what I mean.

Is there a way to make DNF behave like APT or pacman? It would be nice if it could only update repository caches once every 48 hours instead of doing it whenever I try to install a package.

Any help would be appreciated.

The default setting for this in dnf should be 48 hours already. From man dnf.conf:

    ...The default corresponds to 48 hours...

There is also a second setting which affects updates of repo meta:


You first might want to set disable the check_config_file_age


If that still does not act as you expect. you could disable the meta data updates.


The changes should go into /etc/dnf/dnf.conf. Unfortunately there seems to no supported drop-in directory for additional configs for dnf at the moment.

1 Like

Exactly what I needed! Adding the “check_config_file_age=False” to “/etc/dnf/dnf.conf” did the trick. Before I was using “$ dnf install -C” which would give me errors that the cache isn’t up-to-date.

Thanks for the help.