I'm turning off dnf-makecache on my Fedora machines

August 25, 2021

Back when I was in a situation where I wanted to use minimal bandwidth, one of the surprise bandwidth uses was from Fedora's dnf-makecache service and its associated systemd timer. This services runs 'dnf makecache --timer', which will, to quote the manpage:

Downloads and caches metadata for enabled repositories. Tries to avoid downloading whenever possible (e.g. when the local metadata data hasn't expired yet or when the metadata timestamp hasn't changed).

However, if a DNF repository's metadata has changed, this will download the updated metadata. How much gets downloaded seems to vary, but it seems that it can very much add up to a surprise under some circumstances. The --timer option makes DNF not do this if you're on battery power, but you may not be.

(I'm not sure if 'dnf makecache' respects NetworkManager's setting to say that a connection is a "metered" connection, but even if it does, that's a heuristic that can be fooled.)

Unfortunately, Fedora's timer settings for dnf-makecache are what I would politely call quite aggressive. The timer is set to activate once every one to two hours and also for ten minutes after boot. This is more or less perfect for delivering a bandwidth surprise when you don't want it.

All of this is a good reason to turn it off on my laptop, but that doesn't quite explain why I would want to turn it off in either my home desktop or my work desktop. There are two reasons for this. First, on my home desktop, leaving dnf-makecache enabled means that every so often I would have unpredictable surge in bandwidth usage, one that hit the limit of my DSL line, possibly at an inconvenient time (such as during a work video conference). I can live without that sort of surprise.

Second and more broadly, the cache isn't actually useful to me in practice. I apply Fedora DNF updates by hand, and when I apply them I always want to get the very latest updates, so before I run 'dnf check-update' I always force a metadata check anyway (with, in theory, 'dnf clean expire-cache', although sometimes I forget and use the much more heavyweight 'dnf clean metadata'). Explicitly checking for and being prepared to apply updates is also the time when I'm willing to see my home bandwidth go to DNF, not other things.

Leaving dnf-makecache enabled on my work machine probably isn't doing any harm (it has plenty of Internet bandwidth), but it's one more piece of complexity and background (DNF) activity that could someday interfere with what I'm doing on the machine. Plus, I'm currently a bit irritated with dnf-makecache as a whole, so I'm inclined to get rid of it. Fedora machines already have enough magical things happening in the background (as do all modern Linux machines).

PS: I'm pretty certain I first got exposed to dnf-makecache's bandwidth usage (and NetworkManager metered connections) through this old Reddit note.


Comments on this page:

By Robert Earl at 2021-08-30 14:10:37:

Thx for tip! Implemented as specified on F32 notebook 'matthew'.

Thanks -- I am doing the same thing. My machine is usually not on the network, and is dedicated to running an application that is using most of the CPU and most of the memory. Along comes dnf-makecache, finds it can't get enough memory, and systemd-oomd kills my application. Very annoying!

Written on 25 August 2021.
« My interest in Intel's future discrete GPUs (and my likely disappointment)
Using our metrics system when I test systems before deployment »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Wed Aug 25 23:21:03 2021
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.