Ошибка failed to download metadata for repo appstream

Updated on February 10, 2022

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!

Was this article helpful?

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.

Related Articles

I am trying to download java using yum on centOs which I specified in Dockerfile.
After pulling centOs image the run crushed and throw this error!?
also to mention that my server instance is AWS EC2!

Step 2/9 : RUN yum install java -y
 ---> Running in 39fc233aa965
CentOS Linux 8 - AppStream                      184  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command '/bin/sh -c yum install java -y' returned a non-zero code: 1

asked Feb 2, 2022 at 23:01

Yusuf's user avatar

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.

Related Articles

I am trying to download java using yum on centOs which I specified in Dockerfile.
After pulling centOs image the run crushed and throw this error!?
also to mention that my server instance is AWS EC2!

Step 2/9 : RUN yum install java -y
 ---> Running in 39fc233aa965
CentOS Linux 8 - AppStream                      184  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command '/bin/sh -c yum install java -y' returned a non-zero code: 1

asked Feb 2, 2022 at 23:01

Yusuf's user avatar

1

Try editing your dockerfile

FROM centos

RUN cd /etc/yum.repos.d/
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

RUN yum -y install java

CMD /bin/bash

Refer to this code

failed-metadata-repo-appstream-centos-8

answered Mar 1, 2022 at 13:28

BigCat's user avatar

BigCatBigCat

1,5011 gold badge2 silver badges4 bronze badges

5

If you don’t already have it, you’ll need the gpg keys:

wget 'http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-3.el8.noarch.rpm'
sudo rpm -i 'centos-gpg-keys-8-3.el8.noarch.rpm'

Then it’s as simple as transitioning like so:

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

Don’t worry — it doesn’t remove any repos, it simply temporarily ignores all of yours, and downloads information regarding the new mirrors.

You may at this point want to actually upgrade your packages:

sudo dnf distro-sync

You’ll now be able to use «yum» as usual.

Jeff Schaller's user avatar

answered Feb 7, 2022 at 14:44

Hashbrown's user avatar

HashbrownHashbrown

11.9k8 gold badges70 silver badges93 bronze badges

2

Go to /etc/yum.repos.d/

cd /etc/yum.repos.d/

Run

sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
sudo yum update -y

Then do what you want

answered Apr 24, 2022 at 2:39

wsdzbm's user avatar

wsdzbmwsdzbm

2,9513 gold badges23 silver badges28 bronze badges

4

I tried to use CentOS 8 with wsl and got the same error. Steps to fix the problem (as root):

# 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-*
# dnf distro-sync
# dnf -y install java

The top voted answer did not work for me (by @Hashbrown). The answer with Dockerfile was not for my case either.

answered Mar 23, 2022 at 11:16

Daniel Andrzejewski's user avatar

4

Use these commands to update centOS8.0 on AWS EC2:

sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" 
    -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" 
        /etc/yum.repos.d/CentOS-*

tripleee's user avatar

tripleee

174k33 gold badges271 silver badges313 bronze badges

answered Jun 16, 2022 at 8:49

sfl0r3nz05's user avatar

sfl0r3nz05sfl0r3nz05

5178 silver badges13 bronze badges

0

CentOS 8 reached EOL on 2021-12-31 (announcement).

Therefore, the URLs to the mirrors don’t work anymore. Instead of using sed to modify the URLs to point to the archived mirrors, CentOS officially recommends to convert from CentOS Linux 8 to CentOS Stream 8 via:

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

After that, dnf/yum will work again.

Guillaume Jacquenot's user avatar

answered Aug 1, 2022 at 6:44

stackprotector's user avatar

stackprotectorstackprotector

9,9304 gold badges31 silver badges64 bronze badges

2

Try this

FROM centos

RUN cd /etc/yum.repos.d/
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

RUN yum -y install java

CMD /bin/bash

answered Mar 23, 2022 at 22:16

Anup Kumar's user avatar

Please follow the below-mentioned steps:

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

    cd /etc/yum.repos.d/

  2. Run the below commands to hash the mirror-list in all yum.repos.d files then replace the existed Baseurl with the vault.centos.org

    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-*

  3. Then run yum update or install any package you want

    yum update -y

answered May 30, 2022 at 8:35

Mahmud's user avatar

MahmudMahmud

1191 silver badge7 bronze badges

0

Update your docker file with below. It should work.

    RUN  sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
    RUN  sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
    RUN yum update -y

answered Jan 5 at 19:21

viratpuar's user avatar

viratpuarviratpuar

5241 gold badge5 silver badges22 bronze badges

Go to /etc/yum.repos.d/ directory. Open .repo file and manually edit mirrorlist from $releasever to 8-stream.

For example : /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

  1. open file in vi

    sudo vi /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

  2. comment mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra

    #mirrorlist=http://......

  3. within vi, copy paste mirrorlist=http://...... line

    yy and p

  4. uncomment and edit the copied line by replacing $releasever to 8-stream

    mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=BaseOS&infra=$infra

  5. save and exit vi

    :wq

Repeat above 5-steps for other .repo files.

answered Apr 15, 2022 at 11:02

Sathish's user avatar

SathishSathish

12.4k3 gold badges41 silver badges59 bronze badges

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 read this far, tweet to the author to show them you care. Tweet a thanks

Photo of author

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.


Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Skip to content

Ошибка Failed to download metadata for repo ‘AppStream’ характерна для установок CentOS 8, выполненных в 2022 году. Дело в том, что эта версия ОС перестала поддерживаться 31 декабря 2021 года. Это означает, что CentOS 8 больше не будет получать ресурсы для разработки (пакеты) от официального проекта CentOS. Теперь, если вам нужно обновить CentOS, вам необходимо изменить зеркала на vault.centos.org, где они будут постоянно заархивированы. В качестве альтернативы вы можете перейти на CentOS Stream.

Чтобы получать пакеты и обновления, вам необходимо выполнить следующие команды:

cd /etc/yum.repos.d/
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-*
yum update -y

Они во всех файлах со списков репозиториев, начинающих на CentOS- , заменяют mirror.centos.org на vault.centos.org.

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"

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.


Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Источник

Skip to content

Ошибка Failed to download metadata for repo ‘AppStream’ характерна для установок CentOS 8, выполненных в 2022 году. Дело в том, что эта версия ОС перестала поддерживаться 31 декабря 2021 года. Это означает, что CentOS 8 больше не будет получать ресурсы для разработки (пакеты) от официального проекта CentOS. Теперь, если вам нужно обновить CentOS, вам необходимо изменить зеркала на vault.centos.org, где они будут постоянно заархивированы. В качестве альтернативы вы можете перейти на CentOS Stream.

Чтобы получать пакеты и обновления, вам необходимо выполнить следующие команды:

cd /etc/yum.repos.d/
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-*
yum update -y

Они во всех файлах со списков репозиториев, начинающих на CentOS- , заменяют mirror.centos.org на vault.centos.org.

Источник

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.

Источник

Понравилась статья? Поделить с друзьями:
  • Ошибка failed to create the d3d9 device
  • Ошибка failed to create process
  • Ошибка failed to create performance object
  • Ошибка failed to create opengl context for format qsurfaceformat
  • Ошибка failed to create key software