4

In systemd (CentOS8) i noticed dnf popping up in the logs (/var/log/messages) even after i did dnf remove dnf-automatic. I discovered a timer running (systemctl list-unit-files --type=timer) for dnf-makecache.timer.

The best i could find online is that dnf-makecache "updates Repo Caches". Okay, but what does that actually mean? Why do repo caches need to be updated every hour? Wouldn't this happen anyways if using update manually with dnf update?

Would dnf update fail or not get the newest versions if dnf-makecache hasn't been refreshing? Or is this something that compliments dnf-automatic and isn't needed if not using automatic? IMO: if that is the case it should have been removed when dnf-automatic was removed.

Negatives / Cons to disabling this timer with systemctl disable dnf-makecache.timer and systemctl stop dnf-makecache.timer?

2 Answers 2

3

Okay, but what does that actually mean?

It means that remote index of packages is downloaded to local file cache, in order to speed up subsequent dnf commands.

Why do repo caches need to be updated every hour?

This is done for convenience and speedup of dnf command. Any time you run e.g. dnf install command, it needs to have a "fresh" metadata for repositories. Without it, there are high chances of having to wait for metadata refresh when you run dnf commands interactively.

Note that, despite timer being set to every 1 hr, the effective runtime is no more often than every 3 hrs. This is rather a bug, which is detailed here.

Wouldn't this happen anyways if using update manually with dnf update?

Yes, by default it would happen anyways if metadata is considered stale. That is, exceeded default lifetime of 6 hrs (per-repo definition can override this TTL). It would never happen for a repo if its definition has metadata_expire=-1.

Would dnf update fail or not get the newest versions if dnf-makecache hasn't been refreshing?

No, it would not fail. Although you can say that it could be slightly more reliable provided that metadata is already there and network connection is unstable.

Or is this something that compliments dnf-automatic and isn't needed if not using automatic?

It complements both dnf and dnf-automatic because both will have higher chance on being run with fresh metadata cache in place, and thus running faster.

Negatives / Cons to disabling this timer with systemctl disable dnf-makecache.timer and systemctl stop dnf-makecache.timer?

Slower dnf commands / interactive waiting for installation and updates. Unless you follow up with the article and adjust:

metadata_timer_sync=3600

the timer is quite ineffective and won't do much benefit.

P.S. you ask many questions but in this communities, you should typically ask one :)

Please consult man dnf and man dnf.conf. Those who right documentation, should not do so in vain.

1
  • 1
    Thank you for your time in answering my questions. I did read the man and at least on my system it doesn't answer any of my questions. It only mentions you can set how often the timer will run in seconds. Apr 18, 2020 at 6:40
2

Because my centos 8.1 servers sit behind a firewall and a limited proxy the dnf-makecache-timer repeatedly generates annoying errors. It seems it uses a random dynamic list of servers I can not all to add the trusted proxy-white-list. This would be also against our security guidelines.

With yum there was the possibility to define a list of servers which will be used and respected in (probably) all package-managers actions: mirrorlist=… and include_only=… .

I could not find any working solution or setting in limiting the servers the dnf-makecache timer uses.

Strangely the command-line call never failed when I tried.

As I understand the implied (in my current understanding) legitimate question(s):

"I don't need it, I don't want it, (in our case) it throws errors I can not control: How can I disable it?

I will answer it here:

Add in the [main]-Section of /etc/dnf/dnf.conf

metadata_timer_sync=0

as stated in the dnf.conf - man - page:

 Use 0 to completely disable automatic metadata synchronizing.
1
  • 3
    Or you can just turn it off with systemctl stop dnf-makecache.timer and systemctl disable dnf-makecache.timer May 24, 2020 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.