How to Fix Error: Failed to Download Metadata for Repo ‘AppStream’

If you, for one reason or the other, are still actively using CentOS 8, you might probably have encountered the following error when trying to update your system or simply install a package.

Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist

For example, in the screenshot that follows, I was trying to install the fio package and run into it.

Error: Failed to Download Metadata for Repo 'AppStream'
Error: Failed to Download Metadata for Repo ‘AppStream’

What is the Cause of This Error?

You may well be aware that CentOS Linux 8 died a premature death, it reached the End Of Life (EOL) on December 31st, 2021, thus it no longer receives development resources from the official CentOS project.

This means that after Dec 31st, 2021, to update your CentOS installation, you are required to change the mirrors to CentOS Vault Mirror, where they will be archived permanently.

Fix Error: Failed to Download Metadata for Repo ‘AppStream’

To fix the above error, open your terminal or login via ssh, and run the following commands to change the repo URL to point to, from the official CentOS repos.

Here we use the sed command to edit the required directives or parameters in the repo configuration files:

# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
# sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-*

Alternatively, you can also point to the Cloudflare-based vault repository, by running the following commands:

# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
# sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-Linux-*

Now you should be able to update CentOS or install packages without any error:

Install Packages in CentOS 8
Install Packages in CentOS 8

If you wish to migrate from CentOS 8 to Rock Linux 8 or AlamLinux 8, check these guides:

That’s all! We hope that this guide helped you fix the above-aforementioned error. Use the comment form below to share feedback with us, you can ask questions as well.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

1 thought on “How to Fix Error: Failed to Download Metadata for Repo ‘AppStream’”

  1. This is used for CentOS Linux, but in the case of centos appstream use the following trick

    Go to /etc/yum.repos.d.

    Add in CentOS-Stream-AppStream.repo

    Add in CentOS-Stream-BaseOS.repo

    Add in CentOS-Stream-Extras.repo



Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.