CentOS 8: No URLs in mirrorlist error
If you use CentOS 8, you might have noticed that starting from January 31, 2022, installing packges with
yum no longer works with an error
No URLs in mirrorlist, similar to the following:
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The same issue could hit you if you use Docker container images based on
What is the reason behind this? Why did everything work fine just yesterday? This short article explains the reason of the error and how to solve it.
On January 31, 2022, CentOS team has finally removed all packages for CentOS 8 from the official mirrors. CentOS 8 has reached its end-of-life on December 31, 2021, but the packages were kept on the official mirrors for a while. Now they’re moved to https://vault.centos.org
The proper way of handling the issue would be to migrate to CentOS Stream 8. But what if you can’t afford this? Here’s a solution that worked for me.
If you still need to run your old CentOS 8, you can update the repos in
/etc/yum.repos.d to use
vault.centos.org instead of
mirror.centos.org . Here are two simple commands to do this, both need to be run with
They essentially replace the base URL with the one that’s still functioning. This should solve the issue for a while, but keep in mind that you won’t receive any updates for CentOS 8 anymore. In the long run, try to upgrade to the Stream version.
This solution worked for me. I hope this short article helped to resolve the issue for you too.
Update: if you face an “Error setting up base repository” error during CentOS 8 installation, it’s related to the same problem, and can be fixed as described in my follow-up article.