Error during downloading metadata for repository 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

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"

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.

NOTE:

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 vault.centos.org 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=http://mirror.centos.org|baseurl=http://vault.centos.org|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
=============================================================================================================================================================
Installing:
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
Upgrading:
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.

I had installed a minimalist CentOS 8 on one of my servers. Installation went successful, however, when I tried to update the system using yum update I see this error message: Failed to download metadata for repo. Below is the complete error.

[root@autocontroller ~]# yum update
CentOS-8 - AppStream 70 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

Output from the /var/log/dnf.log for more DEBUG information:

2022-02-02T11:39:36Z DEBUG error: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
2022-02-02T11:39:36Z WARNING Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
2022-02-02T11:39:36Z DDEBUG Cleaning up.
2022-02-02T11:39:36Z SUBDEBUG
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/dnf/repo.py", line 573, in load
ret = self._repo.load()
File "/usr/lib64/python3.6/site-packages/libdnf/repo.py", line 394, in load
return _repo.Repo_load(self)
RuntimeError: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

But, then verified with the internet connection and DNS and it works just fine as below:

[root@autocontroller ~]# ping google.com
PING google.com (172.217.166.206) 56(84) bytes of data.
64 bytes from del03s13-in-f14.1e100.net (172.217.166.206): icmp_seq=1 ttl=115 ti me=43.5 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 43.508/43.508/43.508/0.000 ms

So how did I fix the issue? Here it is.

CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently. Alternatively, you may want to upgrade to CentOS Stream.

Step 1: Go to the /etc/yum.repos.d/ directory.

[root@autocontroller ~]# cd /etc/yum.repos.d/

Step 2: Run the below commands

[root@autocontroller ~]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@autocontroller ~]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

Step 3: Now run the yum update

[root@autocontroller ~]# yum update -y

That’s it!

Author Profile

Ramya Santhosh

is a Web Designer and content creator. A freelance writer on latest trends in technology, gadget reviews, How to’s and many more.

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 vault.centos.org, 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=http://mirror.centos.org|baseurl=http://vault.centos.org|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=http://mirror.centos.org|baseurl=http://vault.epel.cloud|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:

  • How to Migrate from CentOS 8 to Rocky Linux 8
  • How to Migrate from CentOS 8 to AlmaLinux 8.5

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.

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.

Если вы столкнулись со следующей ошибкой в CentOS 8 при попытке обновить пакеты с помощью dnf update или yum update в этом руководстве мы исправим эту проблему.

Исправление  в CentOS 8: “Ошибка: Failed to download metadata for repo appstream”

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

Исправление: Переход на CentOS Stream 8 или альтернативный дистрибутив

Пользователи CentOS переходят на альтернативные дистрибутивы CentOS, потому что CentOS перешла на Stream – дистрибутив Linux, который находится на полпути между разработкой Fedora и разработкой RHEL.

Другие перешли на CentOS Stream 8, чтобы остаться с CentOS.

Оба этих варианта позволят вам обновить CentOS 8, несмотря на то, что вы не можете этого сделать напрямую.

Переход с CentOS 8 на CentOS Stream 8:

dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos

dnf distro-sync

Это поможет вам решить проблему, с которой вы столкнулись при обновлении пакетов или установке новых.

jobe

Posts: 2
Joined: 2020/10/26 10:55:07

CentOS 8: Failed to download metadata for repo ‘appstream’

Hi everybody, on my CentOS 8 server (CentOS Linux release 8.5.2111) today I used «dnf update» command, but I received this error:

Code: Select all

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

The server is connected to the internet and can download files.
Since CentOS 8 is EOL, have they changed or removed CentOS 8 repos? I did not find any confirmation on centos site. Do you have any clue?


User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by TrevorH » 2022/01/31 11:19:38

CentOS 8 went EOL at the end of December and in line with all the public announcements, the content of the CentOS 8 repos has been moved to vault.centos.org.

It’s time to move to something else.


jobe

Posts: 2
Joined: 2020/10/26 10:55:07

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by jobe » 2022/01/31 12:02:10

Thanks for the clarification. Yes, I am migrating to Rocky ;)



User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by TrevorH » 2022/01/31 20:37:35

The correct and easy way to migrate from CentOS Linux 8 to CentOS Stream 8 is to run:

Code: Select all

dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
dnf distro-sync

[Edited with the v2 version of how to…]


Egyas

Posts: 1
Joined: 2022/01/31 22:26:03

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by Egyas » 2022/01/31 22:28:18

I created an account here JUST so that I could say «THANK YOU!» for this post. :)


User avatar

jlehtone

Posts: 4249
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by jlehtone » 2022/01/31 22:40:11

If Stream feels like a too distant cousin, the «siblings» (RHEL, Alma, Rocky, OL) surely have «sidegrade» scripts.


User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by TrevorH » 2022/01/31 23:00:50

I created an account here JUST so that I could say «THANK YOU!» for this post. :)

Even though it’s the wrong solution?


avoulvou

Posts: 5
Joined: 2022/01/31 20:24:35

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by avoulvou » 2022/02/01 16:45:35

TrevorH wrote: ↑

2022/01/31 20:37:35


The correct and easy way to migrate from CentOS Linux 8 to CentOS Stream 8 is to run:

Code: Select all

dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
dnf distro-sync

[Edited with the v2 version of how to…]

Hi,

you have missed the most important the links dont work any more
So the initial step is
Change url to vault
Else you will have
[root@srv1 ~]# dnf update
CentOS Linux 8 — AppStream 271 B/s | 38 B 00:00
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@srv1 ~]# dnf —disablerepo ‘*’ —enablerepo=extras swap centos-linux-repos centos-stream-repos
CentOS Linux 8 — Extras 40 kB/s | 1.5 kB 00:00
CentOS Linux 8 — Extras 254 kB/s | 10 kB 00:00
Modular dependency problems:

Problem 1: conflicting requests
— nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8030020200716150652:1e4bbb35-0.x86_64
Problem 2: conflicting requests
— nothing provides module(perl:5.26) needed by module perl-IO-Socket-SSL:2.066:8030020201222215140:1e4bbb35-0.x86_64
Problem 3: conflicting requests
— nothing provides module(perl:5.26) needed by module perl-libwww-perl:6.34:8030020201223164340:b967a9a2-0.x86_64
Error:
Problem 1: conflicting requests
— nothing provides centos-gpg-keys = 1:8-3.el8 needed by centos-stream-repos-8-3.el8.noarch
Problem 2: package centos-linux-release-8.4-1.2105.el8.noarch requires centos-repos(8), but none of the providers can be installed
— conflicting requests
— problem with installed package centos-linux-release-8.4-1.2105.el8.noarch
— nothing provides centos-gpg-keys = 1:8-3.el8 needed by centos-stream-repos-8-3.el8.noarch
(try to add ‘—skip-broken’ to skip uninstallable packages or ‘—nobest’ to use not only best candidate packages)

and will crash if you try to continue
after that you can proceed with one option or another


User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 8: Failed to download metadata for repo ‘appstream’

Post

by TrevorH » 2022/02/01 16:47:16

No, you didn’t read the command. It disables ALL repos then enables ONLY the extras repo which is the only CentOS Linux 8 repo still working. There is no need to change the baseurls to vault since it disables all the repos.

You do need the system to be up to date enough to have the latets centos-gog-keys package installed.


Approx. read time : 2 min

In this article, we’ll get to know, how to fix the error, “Failed to download metadata for repo AppStream” in CentOS 8.
For example, you have installed a minimalist CentOS 8 on one of the servers. The entire process of installation goes smoothly and is successful.

But, while updating the system, using the yum update, you’re likely to get the error message, “Failed to download metadata for repo”

Here is the error you’ll get:

[root@server ~]# yum update

CentOS8 AppStream 70 B/s | 38 B 00:00

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

Now the output from the /var/log/dnf.log for more debug information:

20220202T11:39:36Z DEBUG error: Curl error (6): Couldn‘t resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).

2022-02-02T11:39:36Z WARNING Errors during downloading metadata for repository ‘AppStream‘:

— Curl error (6): Couldn’t resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

20220202T11:39:36Z DDEBUG Cleaning up.

20220202T11:39:36Z SUBDEBUG

Traceback (most recent call last):

File «/usr/lib/python3.6/site-packages/dnf/repo.py», line 573, in load

ret = self._repo.load()

File «/usr/lib64/python3.6/site-packages/libdnf/repo.py», line 394, in load

return _repo.Repo_load(self)

RuntimeError: Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: Curl error (6): Couldnt resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]

If you verify the internet connection and DNS, it works alright as given below:

[root@server ~]# ping google.com

PING google.com (172.217.166.206) 56(84) bytes of data.

64 bytes from del03s13inf14.1e100.net (172.217.166.206): icmp_seq=1 ttl=115 ti me=43.5 ms

google.com ping statistics

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 43.508/43.508/43.508/0.000 ms

Now, how to fix this issue? Let’s see in the below steps:

FIXING THE ERROR: FAILED TO DOWNLOAD METADATA FOR REPO

On 31st December 2021, CentOS Linux 9 had reached its End of Life (EOL). This means, it will not receive any development updates from the official CentOS project. Thereafter, 31st December 2021, for updating your CentOS, you will first need to change the mirrors to vault.centos.org. Here they will be archived for all time. Instead, you may also need to upgrade to CentOS stream.

Here are the steps: Step 1:

First go to the /etc/yum.repos.d/ directory.

[root@server ~]# cd /etc/yum.repos.d/

Step2: Now, run the commands given below:

[root@server ~]# sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-*

[root@server ~]# sed -i ‘s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g’ /etc/yum.repos.d/CentOS-*

Step 3: After this, run the yum update:

[root@server ~]# yum update -y

And that’s all!

By following the above steps, you can easily fix the error, “Failed to Download Metadata for Repo ‘AppStream’.

Понравилась статья? Поделить с друзьями:
  • Error during connect this error may indicate that the docker daemon is not running get
  • Error during connect in the default daemon configuration on windows
  • Error during compilation inside scicoslab building process of modnum aborted
  • Error during capture error code 80070005
  • Error during babel initialisation bad boys 2 что делать