How to refresh the (DNF5) package cache without performing another action?

When I want to test the repositories, [1] I’m forced to run something like sudo dnf5 search '' --refresh, instead of merely dnf5 refresh. Does a real equivalent to that exist?


  1. t/157328/3 ↩︎

man dnf

dnf makecache
1 Like

@anotheruser, thanks. sudo dnf5 makecache --refresh appears appropriate.

actually if you want to force check for new metadata then dnf clean expire-cache && dnf makecache does the job, too.

or change the time period after which metadata expires
grep -e '\[' -e expire /etc/yum.repos.d/fedora-updates.repo

1 Like

@anotheruser, is dnf clean expire-cache better because dnf clean all removes data that doesn’t relate to this?

It’s not quite the same, because metadata file also have alternative versions of the repo data and if local repo data is considered as a valid alternative, then dnf will not downlod the newer repo data files.

dnf clean metadata && dnf makecache
has the same result as dnf makecache --refresh

@anotheruser, I can’t say I understand. This looks like 3 ways to accomplish the same. I expected that clean expire-cache and clean metadata might be smaller in scope than clean all, but even if so, clean expire-cache and clean metadata appear identical.

take a look at /var/cache/libdnf5/updates-[0-9]*/metalink.xml

metalink.xml has 2 alternative valid, older, repo data.

@anotheruser, what keys? I see URIs to repositories and their associated timestamp of acquisition (in UNIX Epoch format), but little else. Certainly, I don’t much see how it would demonstrate the differences between those commands.