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

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.

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

12k8 gold badges71 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,9813 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

174k34 gold badges272 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

10.1k4 gold badges32 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

Having great difficulty tracking down what is causing the below error when attempting to update any package from any repo. I have tested multiple repos by setting all others to disabled. I have cleaned all cache and removed any dnf yum cache files.

# dnf -v update
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
DNF version: 4.2.7
cachedir: /var/cache/dnf
repo: downloading from remote: AppStream
error: Curl error (28): Timeout was reached for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Resolving timed out after 30000 milliseconds] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
CentOS-8 - AppStream                                                                                                                                                     0.0  B/s |   0  B     00:30    
Cannot download 'http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Resolving timed out after 30000 milliseconds].
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

Each time I attempt a dnf update, load average on the server goes thru the roof, up to 40x

curl can access the mirror site.

curl 'http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock'
http://ftp.tc.edu.tw/Linux/CentOS/8.2.2004/AppStream/x86_64/os/
http://mirror.horizon.vn/centos/8.2.2004/AppStream/x86_64/os/
http://ftp.jaist.ac.jp/pub/Linux/CentOS/8.2.2004/AppStream/x86_64/os/
http://centosg9.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://packet01.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://mirror.s8.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centoso7.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosh9.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosc8.centos.org/centos/8.2.2004/AppStream/x86_64/os/
http://centosg7.centos.org/centos/8.2.2004/AppStream/x86_64/os/

I have also tried using baserurl in .repo, same error

I have also replaced the baseurl with one of the url’s returned by curl, same error

I have tried many suggestions such as yum/dnf error: Failed to download metadata for repo
and similar, none work for me.
Some articles point to bugs in the env vars for $releaseserver etc. I have also tried replacing with actual values. same error.

Internet connection obviously OK due to curl result.
No proxy used.
DNS OK

cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

uname -a
Linux xxxx 4.18.0-147.5.1.el8_1.x86_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Any suggestions would be greatly appreciated.

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.

Previously, we looked at What CentOS alternative distro should you choose? That article was posted before End of Life (EOL) for CentOS 8 – December 31st, 2021. CentOS 8 will NOT automatically migrate to the next version (CentOS Stream 8). There will be no more updates to CentOS 8.

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

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
If you still manage systems running CentOS 8 and you attempt to update packages using dnf update or yum update, you will encounter the following error:

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

Fix: Migrate to CentOS Stream 8 or an alternative distro

Now that CentOS has shifted to Stream – a rolling-release Linux distribution, midstream between the upstream development in Fedora and the downstream development for RHEL – many users are moving to CentOS alternatives. Others have decided to stick with CentOS by migrating to CentOS Stream 8. Both of these choices will resolve not being able to update CentOS 8.

To migrate from CentOS 8 to CentOS Stream 8, run the following commands:

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

Migrating to alternative distros is usually just as simple:

For example, follow this guide to migrate from CentOS 8 or CentOS Stream 8 to Rocky Linux. Also, see this list of CentOS 8 alternatives.

Tags: CentOS, linux, security, server, sysadmins

  • Ошибка failed to allocate video memory doom eternal
  • Ошибка failed to create signature error ошибка исполнения функции 0x8007065b проверка
  • Ошибка failed security check for loco nonce
  • Ошибка f92 webasto как сбросить
  • Ошибка failed to create flash