Get freshest metadata in dnf on Fedora

5

1

I noticed that when I clean dnf's metadata and then run dnf upgrade to fetch new metadata and check for upgradeable packages multiple times, it tends to often download different amounts of data which sometimes result in one run not having any updates while the next run might do.

How can I fix this and always get the freshest (i.e. newest) metadata in dnf on Fedora (26)?

Screenshot of dnf after multiple runs

comfreak

Posted 2017-08-11T11:51:14.773

Reputation: 739

Answers

5

Just run dnf clean expire-cache first to make sure it validates the cache before using it or, even better, just add --refresh to your command because, as the manual page says:

    --refresh
           set metadata as expired before running the command

TomH

Posted 2017-08-11T11:51:14.773

Reputation: 2 558

That's not the problem. What I do is I remove all of the cached metadata via dnf clean all before the dnf upgrade command. The problem is what it downloads as metadata differs in multiple runs of the two commands. – comfreak – 2017-08-11T13:54:29.437

Well that shouldn't be possible - everything is checksummed and if you expire the cache it will refetch the root descriptor and then validate everything else against those checksums and refetch them if they are wrong. – TomH – 2017-08-11T16:38:42.373

It's probably hitting different mirrors, which may not all be synced to the latest updates. – mattdm – 2017-08-11T17:44:09.077

@mattdm That's my guess as well, but how do you fix that? Can I change it to their source directly? Or is the only option that I create my own mirror? – comfreak – 2017-08-11T18:23:52.190

Creating your own mirror is a decent option, or you can edit the .repo files to point at a specific mirror. If you have more than one system, creating your own mirror is likely the best choice. And please don't point at the main Fedora servers, because if everyone did that we'd be overwhelmed. Find a fast, nearby mirror and use that. – mattdm – 2017-08-11T18:31:42.520