Error: Failed to synchronize cache for repo 'updates'

Naveen Kumar picture Naveen Kumar · Jul 26, 2017 · Viewed 56.9k times · Source

I am using Fedora 25. I'm trying to install gcc on fedora25 using the sudo dnf install gcc command. It is always showing:

Error: Failed to synchronize cache for repo 'updates'

I am also getting the same error when I try to install other packages. What am I doing wrong?

Answer

jcope picture jcope · Nov 10, 2017

I just ran into this as well. Adding the verbose flag showed the $releasever wasn't set in the url. Check this yourself with dnf update -v

Look for these lines in the output:

Cannot download 'https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=x86_64': Cannot prepare internal mirrorlist: file "repomd.xml" was not found in metalink. 
Error: Failed to synchronize cache for repo 'fedora'

I fixed the issue with dnf clean all && dnf update --releasever=25. This overrides the $releasever with the one you supply. After that, I was able to update and install rpms again.