Ask Your Question

How to disable metadata auto-refresh of DNF ?

asked 2018-12-19 04:24:15 -0500

Chitholian gravatar image

Although I don't pass --refresh argument sudo dnf install something refreshes (i.e. redownloads) the metadata caches. I have made all the metadata expiry more than 7 days. If it refreshes metadata once, it obeys (that is, does not refresh again, instead, it shows the time how long ago the cache was refreshed). But if I reboot my machine and again try to install some package it will again refresh the metadata.

I need to disable this behavior. I want, "If I do not pass --refresh, do not refresh automatically".

I run Fedora 29 KDE.

edit retag flag offensive close merge delete


It's not exactly what you want, but you can try -C, --cacheonly option.

Run entirely from system cache, don't update the cache and use it even in case it is expired.

As a workaround at least. You'll have to always use it or make an alias with it.

Night Romantic gravatar imageNight Romantic ( 2018-12-19 07:19:01 -0500 )edit

I think you have asked that same question already before and received the same answer:

florian gravatar imageflorian ( 2018-12-19 13:37:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-19 07:43:49 -0500

Night Romantic gravatar image

updated 2018-12-19 08:59:08 -0500

Please check these two dnf.conf options in man dnf.conf:


time in seconds

The minimal period between two consecutive makecache timer runs. The command will stop immediately if it's less than this time period since its last  run.

Does  not  affect simple makecache run. Use 0 to completely disable automatic metadata synchronizing. The default corresponds to three hours. The value is rounded to the next commenced hour.


time in seconds

The period after which the remote repository is checked for metadata update and in the positive case the local metadata cache is updated. The default corresponds  to 48 hours. Set this to -1 or never to make the repo never considered expired. 
Expire of metadata can bee also triggered by change of timestamp of configuration files (dnf.conf, <repo>.repo). See also check_config_file_age.

metadata_timer_sync man entry and this question in dnf's FAQ suggest that this option is applicable to automatic sync service, it may not change the behavior when you run dnf install.

I'd try to set metadata_timer_sync to 0 and metadata_expire in [main] section of dnf.conf to -1 and then check the behavior.

Also you need to check that .repo files don't override metadata_expire option for specific repos.

edit flag offensive delete link more


I have already done so. Yet refresh trial happens after a reboot.

Chitholian gravatar imageChitholian ( 2018-12-20 03:15:49 -0500 )edit

Does --cacheonly option suppress refresh (after reboot)? You can also try enabling an option "Minimize background data transfers" in the properties/settings of your network connection. I don't think it'll help with the dnf refresh (but what if it does miraculously), but it can save you some traffic if that's the reason behind your question.

You can also try to report a bug (or check if there are already something similar).

Night Romantic gravatar imageNight Romantic ( 2018-12-20 03:29:32 -0500 )edit

Thanks, it is working now.

Chitholian gravatar imageChitholian ( 2019-01-07 21:22:04 -0500 )edit

Question Tools



Asked: 2018-12-19 04:24:15 -0500

Seen: 1,330 times

Last updated: Dec 19 '18