Failure to load metadata for 'AppStream' [CentOS] repo on CentOS 8
Introduction
When you run an update or try to install a package on CentOS 8, the package manager may stop with this error:
Failed to load metadata for 'AppStream' repo: Cannot prepare internal mirror list: No URLs in mirror list.
This is not a network glitch or a temporary mirror problem. It is the expected result of CentOS 8 having reached its end of life. This article explains why the error happens, what the correct long-term fix is, and how to bring the system back online temporarily if you still need access to it.
Why this error happens
CentOS Linux 8 reached end of life on December 31, 2021. After that date the mirrorlist service for CentOS Linux 8 was retired and the packages were moved to the archive server vault.centos.org.
The repository files on the system still point to mirrorlist.centos.org. Because that service no longer returns any URLs, the mirror list comes back empty, and the package manager has no address to download metadata from. That is the message you see.
The packages were not deleted. They were moved to an archive server, vault.centos.org. This is what makes the temporary fix below possible.
Recommended solution: migrate to AlmaLinux or Rocky Linux
Because CentOS 8 no longer receives any updates, including security updates, keeping it in production is a risk. The correct solution is to move to a distribution that is binary compatible with the system you already run.
AlmaLinux and Rocky Linux are free, community supported rebuilds of Red Hat Enterprise Linux. They are designed as direct replacements for CentOS, so existing software and configuration keep working with no changes in most cases. Both projects provide an in place migration script that converts CentOS 8 without reinstalling the server.
Always take a full backup or a snapshot before migrating. An in place conversion changes core system packages, and you want a way back if anything goes wrong.
Both migration scripts need a working package manager to download the new packages. On an end of life CentOS 8 system the repositories are dead, so apply the temporary fix in the next section first, then run the migration.
To migrate to AlmaLinux 8:
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh bash almalinux-deploy.sh
To migrate to Rocky Linux 8:
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh bash migrate2rocky.sh -r
After the script finishes, reboot the server and confirm the new system with:
cat /etc/os-release dnf repolist
If the server cannot be migrated in place, or you would rather start clean, deploy a new VPS with AlmaLinux or Rocky Linux already installed and move your data across. INTROSERV offers Linux VPS with these distributions available at order time.
Temporary fix: point the repositories to the archive
Use this only when you need the system working again for a short time, for example to take a final backup before migrating, or to keep a non-critical machine running until migration can be completed. It does not make CentOS 8 supported again and it does not bring back updates.
Before running the commands below, check the exact version of your installation with cat /etc/centos-release. This article uses 8.5.2111 as an example. Replace it with the version reported on your own system. If you specify the wrong archived release, DNF may return 404 errors because that directory does not exist for your installation.
The commands below disable the dead mirror list and point the repository files to the archive server vault.centos.org instead:
cd /etc/yum.repos.d/ sed -i 's/^mirrorlist/#mirrorlist/g' CentOS-* sed -i 's|^#baseurl=.*mirror.centos.org|baseurl=https://vault.centos.org|g' CentOS-* sed -i 's|/$contentdir/$releasever/|/8.5.2111/|g' CentOS-*
Unlike the live repositories, the archive is organized under fixed release directories, for example 8.5.2111. As a result, the default $releasever path no longer points to valid content and must be replaced with the exact archived release. This applies to all three default repository files, AppStream, BaseOS, and Extras, not only AppStream.
After running the commands above, verify each repository file individually rather than trusting the batch edit blindly, since a bulk sed across three files is an easy place for a stray character or wrong separator to slip in unnoticed.
Check the AppStream file:
cat CentOS-Linux-AppStream.repo
The baseurl line should read exactly as follows, with the release directory matching your own version:
baseurl=https://vault.centos.org/8.5.2111/AppStream/x86_64/os/
Check the BaseOS file the same way:
cat CentOS-Linux-BaseOS.repo
And the Extras file:
cat CentOS-Linux-Extras.repo
Once all three files are confirmed, clean the cache and rebuild it:
dnf clean all dnf makecache dnf repolist
If a repository was fixed correctly, it now downloads its metadata without errors. If one file still has a typo, dnf reports the specific repo that failed, which makes it easy to go back and check just that file.
The archive holds the last packages released before end of life. You will not receive any newer versions or security patches. Treat this as a way to keep the system reachable until you migrate, not as a permanent state.
To confirm that packages install correctly and not just that metadata loads, test with any small package:
dnf install -y wget
Once this succeeds, run the actual update:
dnf update -y
Conclusion
The AppStream metadata error on CentOS 8 is a sign that the distribution has reached end of life. The only long-term solution is to migrate to a supported, binary-compatible distribution such as AlmaLinux or Rocky Linux, ideally after a full backup. The vault.centos.org workaround is still useful, but only as a short bridge that gets the server running long enough to move off CentOS 8 safely.