Solved "Failed to download metadata for repo AppStream"


In this article, I will take you through the steps to solve "Failed to download metadata for repo AppStream" error which I was getting in my CentOS 8 Server while trying to update it using dnf update command. This problem can be encountered in any of the CentOS 8 system which is still in use post December 31st, 2021. The reason is because CentOS 8 had already reached its End of Life(EOL) on this date which means that it will no longer receive any development updates from official CentOS Project.

But if you are still thinking to use or already using this OS after Dec 31st, 2021 due to any reason then you need to change the mirror to Vault where it will be archived permanently like it happened for other older CentOS versions. I am sure many of you are still using CentOS 8 system so probably you might be facing the same issue so I thought to create an article about this so that it will help you guys also.

Solved "Failed to download metadata for repo AppStream"

Solved "Failed to download metadata for repo AppStream"

Also Read: How to Install and Use balenaEtcher on Debian 11 (Bullseye)

So when I tried to update my CentOS 8 Server using dnf update command then I end up having below Failed to download metadata for repo 'AppStream' error.


Please note that here I am using root user to run all the below commands. You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to the User.
[root@localhost ~]# dnf update
CentOS-8 - AppStream 35 B/s | 38 B 00:01
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

To fix the above error, we need to change the repo URL pointing from official CentOS URL to using below commands.

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-*

Once the mirror is changed and updated, we can now try to update again by using dnf update command as shown below. This time it works fine as expected. Alternatively, we can also think of migrating CentOS 8 to CentOS 8 Stream to get rid of problems like this.

[root@localhost ~]# dnf update
Last metadata expiration check: 0:03:09 ago on Thu 05 May 2022 11:27:35 PM EDT.
Dependencies resolved.
Package Architecture Version Repository Size
centos-linux-release noarch 8.5-1.2111.el8 BaseOS 22 k
replacing centos-release.x86_64 8.1-1.1911.0.8.el8
replacing centos-repos.x86_64 8.1-1.1911.0.8.el8
kernel x86_64 4.18.0-348.7.1.el8_5 BaseOS 7.0 M
kernel-core x86_64 4.18.0-348.7.1.el8_5 BaseOS 38 M
kernel-modules x86_64 4.18.0-348.7.1.el8_5 BaseOS 30 M
PackageKit x86_64 1.1.12-6.el8 AppStream 599 k

Hopefully, this will help you solve Failed to download metadata for repo AppStream error. Please let me know your feedback in the comment box.

1 thought on “Solved "Failed to download metadata for repo AppStream"”

Leave a Comment