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.
Fix Failed to download metadata for repo
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!
Thank you:)
thanks a lot
Thank you very much for your great work. It worked really well for me!
You safe my day ๐
thanks
Thx it works ๐
Thank you!!
good job, thank you
Perfect! I was using a cloud image that did not have a mirrorlist this was a fast to the point article. Thanks Ramya
it was very helpful for me thank you
Thanks, it worked for me in CentOS v8.2 server.
Excellent! It worked like a charm, thank you in advance ๐
This was really helpful. Nothing else I tried helped. Thank you.
Worked for me !
it worked ….. actually it was a Zabbix machine
Thanks! Don’t need to upgrade to Rocky for this app.
Worked for me ! Thx !
This work? Very Thnx
Solved exactly the problem described
worked like a charm, thanks!
On point and my issue was resolved instantly. #kudos
???????!!! Good job!
This worked. Thank you. Busy testing Proxmox, and deployed a CentOS container but couldn’t update it.
Very Good ;))
S2 – save-me
thanks. helped me
Worked like a charm. Thank you!
Thanks !!!
Great guide, worked flawlessly
perfect <3
Thnak you very much!
I did above steps but still getting same error
Does not work. Same error.
Thanks man. Saved me a lot of time
Thanks dude
Usefull, resolve my issue.
Good
Thank you so much it works ๐
dont work!!!
Working!
Thank you so much
Thanks it worked perfectly.
thanks. It works.
Thank you!
Goto your /etc/yum.repo.d/ directory. And then modify your OS-AppStream.repo & OS-BaseOS.repo by activating instead of .
Thanks for this!
i got : Cannot find a valid baseurl for repo: appstream
but still an issue with Remi after this: Problem: cannot install the best update candidate for package remi-release-8.4-1.el8.remi.noarch
Thanks alot!! This has resolved the issue.
it’s working great! thankyou
Not working for me
Simple solution that works! Keep it up!
thank you it worked
Thanks a lot!
It does not work for me
thanks for the update
Thank you so much!
straight to the point, fixed a wrong distro repo added previously by using RedHat instead of Centos 8
Thanks a lot, works like a charm.
even these methods are not working when i run the “yum update -y” command it shows failed trying other mirror and still doen’t work
thanks a lot, it works
yes its working
good content
works fine.thank you
thanks
Thank you very much!
thanks ๐
thanks man, done
Worked for my centos container, thanks !
thanks, it comes in handy
Fixed the issue for me, thank you! <3
Worked smoothly
issue persists
Thank you very much! so helpful for me! I have solved my problem thank for you.
worked in seconds Thanks
many thanks you save me to spent time to fix it. You are the best ๐
Thank you, it worked.
Many thanks for this, was struggling to update and switch to CentOS Stream until I found this.
this was helpful thanks
oyeah great. Many thanks
Excelente guรญa
NAH MANNN i followed all ur steps and i got the same error ๐
Errors during downloading metadata for repository ‘appstream’:
– Curl error (6): Couldn’t resolve host name for http://vault.centos.org/centos/8-stream/AppStream/x86_64/os/repodata/repomd.xml [Could not resolve host: vault.centos.org]
Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
still getting this error , how can i fix this ?
http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml
should be of
https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml
Thanks it working can please explain both command
Very good. Instantly fixed my issue
Cannot find a valid baseurl for repo: AppStream
Same here. Any idea what to do about it?
Worked perfectly. Thanks
Very helpful, Thanking you
Thanks a lot. ! This saved my day.
good its more helpful, thanking you
No solution found after executing above steps
Kudos
Thanks! Very helpfull!
Good job, thank you
some how is not working for me
works like a charm. Why does centos/redhat make these things so difficult.
very helpful. But the question remains: Why do they make these updates so difficult
not working
error as before
fixed the problem
Worked fine! ๐
The same error.
Excellent article, and easy solution, thanks
hi,
please.. which difference is between
sed -i ‘s/
sed -i ‘s|
thanks ๐
If the search object (or replacement object) contain / as in the 2nd search object then / can’t be used as object delimiter hence the use of | instead
You are my hero
๐
Really help a lot and useful …!
Thanks! That worked like a charm!
Worked fine, thank you.
Great recipe! Thanks
thanks. that was worked
Very helpful. Worked like magic. Thank you.
I tried it but still receive the same error
Thank you so much!
Thank you! It worked on first try!
Thanks a lot, easy read and fix! ๐
Didn’t work.
me too
thank you !!
it did work. thanks
After executing the steps that you have provided, I still get the same error…
CentOS Linux 8 – AppStream 23 B/s | 38 B 00:01
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command ‘/bin/sh -c yum update -y’ returned a non-zero code: 1
me too. If anyone knows answer please post.
I figured out that after you run ‘yum update’ you need to re-run these 3 commands:
sudo cd /etc/yum.repos.d/
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-*
This worked for me.
That did it.
Re-run is the key.
Thank you so much !!!
Thank you so much
Did not work for me
Thank you! It worked on first try!
CentOS Linux 8 – AppStream 1.3 kB/s | 986 B 00:00 Errors during downloading metadata for repository ‘appstream’: – Status code: 403 for http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 52.222.236.36) Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
http://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml should be of https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml
[root@ip-172-31-34-89 yum.repos.d]# sed -i ‘s/^baseurl=http:/baseurl=https/’ CentOS-*
[root@ip-172-31-34-89 yum.repos.d]# egrep ^baseurl CentOS-*
CentOS-AppStream.repo:baseurl=https//vault.centos.org/centos/8/AppStream/x86_64/os/
CentOS-Base.repo:baseurl=https//vault.centos.org/centos/8/BaseOS/x86_64/os/
CentOS-Extras.repo:baseurl=https//vault.centos.org/centos/8/extras/x86_64/os/
CentOS-PowerTools.repo:baseurl=https//vault.centos.org/centos/8/PowerTools/x86_64/os/
[root@ip-172-31-34-89 yum.repos.d]# yum update -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
CentOS-8 – AppStream 0.0 B/s | 0 B 00:00
Error: Failed to download metadata for repo ‘AppStream’: Cannot download repomd.xml: Empty mirrorlist and no basepath specified!
Step 1: Try removing the cache using the below commands:
rm -rfv /var/cache/yum/*
yum clean all
Step 2: Disable the subscription manager
vim /etc/yum/pluginconf.d/subscription-manager.conf
enabled=0
[root@ip-172-31-34-89 yum.repos.d]# sed -i ‘s/\$contentdir/centos/’ CentOS-*
[root@ip-172-31-34-89 yum.repos.d]# yum update
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
CentOS-8 – AppStream 59 MB/s | 8.4 MB 00:00
CentOS-8 – Base 48 MB/s | 4.6 MB 00:00
CentOS-8 – Extras 294 kB/s | 10 kB 00:00
CentOS-8 – PowerTools 29 MB/s | 2.3 MB 00:00
Dependencies resolved.
Nothing to do.
Complete!
So… Fixed? Thanks
Thanks alot
Very helpful article
Sorry this solution is not working, pls send me right solution
it worked!
He resolve the problem thanks ….
thank you so much
you are excellent.. thank you for all
sed: can’t read /etc/yum.repos.d/CentoOS-*: No such file or directory
worked, thank you
Thank you. it worked perfect…..
you are great…..thanks for gold content
worked thanks
YAHH help to get solution
Hello, I’ve created a virtual machine and I had the same issue but the is: sed: couldn’t open temporary file /etc/yum.repos.d/sedhZ7EUE: Permission denied.
How can I get the permission?
Thank you very much, this solved my issue as well!
Sooperb information. I have encounter this issue when i try to install autofs utility. Now my issue is resolved. Thank you for sharing such beautiful information. –Bilal
worked like a charm, thx
Thanks ! Simple, clear and it works ! Exaclaty what I need !
Thanks, dude !
it worked perfect for me thanks so much
Thanks, works like a charm.
After executing the steps that you have provided, I still get the same error
Thanks, it works ๐
great, thank you
Muy buen aporte me sirvio mucho gracias (Very good contribution it helped me a lot thank you)
great, thank you
Great stuff. Very efficient. Thank you so much.
Worked for me! Thanks a lot.
It is very useful thanks.
It works !! thanks a lot!
Great works for me. thanks a lot.
everything was great, the issue was explained and the fix was clear. Tried so many other sites and forums, all talking about the issue but not giving a clear resolution to fixing the repos since the official support ended.
Thank you soo much, it worked
Good
Thanks for this post. It’s solve my problem.
Thanks!Got it!
Excellent fix!
good. i’ve successfully updated my CentOS 8.3 to 8.5 after this repo change.
thanks it worked very well!!!
Thanks you your guidance helped me:)
Thanks, this worked!
Thank you for share solution!!
Did work as described. Thanx
Very helpful ! Thanks
Thanks, it worked
Thank you. This worked.
Very useful ! Thanks
Thank you! It works perfectly
Cool! It worked!
thank you : ))))
Smooth as sailing !! Thanks heaps!
worked
Thank you
Following steps above I migrated successfully a CentOS 8 to CentOS Stream 8 in Oracle cloud. Thanks a lot
thank you it’s help
Thank you for the help. Was trying to upgrade Centos 8.1 to the latest released version/packages in the vault before migrating to Rocky.
HI i am getting same error. [root@c792b3ab5701 /]# cd /etc/yum.repos.d/ [root@c792b3ab5701 yum.repos.d]# sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-* [root@c792b3ab5701 yum.repos.d]# sed -i ‘s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g’ /etc/yum.repos.d/CentOS-* [root@c792b3ab5701 yum.repos.d]# yum update -y Failed to set locale, defaulting to C.UTF-8 CentOS Linux 8 – AppStream 0.0 B/s | 0 B 00:00 Errors during downloading metadata for repository ‘appstream’: – Curl error (60): Peer certificate cannot be authenticated with given CA certificates for https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [SSL certificate problem: certificate is not yet valid] Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried [root@c792b3ab5701 yum.repos.d]#
Worked for me
After applying the suggested changes, I’m still facing the issue
Very clear and direct solution. good job.
Yes Danke !!
Thank you!
worked
Thanks, it’s work!
thank!!!
work like charm
It worked for me. Thanks!
Tks, you help me so much!
This was a big help. Thank you.
Great thanks!
wow, amazing, thanks!!
thanks maaaaan
Thanks for sharing this.
Very nice, tks!
Thank you Ramya
Funcionou corretamente aqui. Obrigado (Portugese) – It worked correctly here. Thanks
Great bro worked on my docker container
Great ! It worked
Thanks, This working!
super thanks
thank you sir
Thank you!
worked like a charm
Thanks, it worked
worked for me – thanks !
Thanks a lot!
It works. Thanks so much
Thanks for wonderful help article …
excellent it workโs. Regards
very good
It works. Thanks so much.
excellent it work’s thank you
explain your commands not only say “run them”!!
great job! thanks.
Thanks a lot, error resolved for me
Exact soluction
Thank you
Gracias Amiga me salvaste el asterisco 2 horas instalando se ivan al tacho pero con tu magia y tu toque de balon ese futbol picante con 2 o 3 comandos me solucionaste la vida,
Waw, This post really helped me.
I was looking for solution since 2 days.
Thank You
It doesn’t work
Thanks a lot !!! The error solved
everything works! thanks
Great, It works ๐
it works on centos8. thanks
it`s work!
works! thx!
It just worked, thank you!
Amazing bro,Thanks much
very thanks!!!
Thank U Bro!
The boom. Love it when a fix come together ๐
Thank you very much, very helpful
Yes, it is helpful. Thank you!!!
thanks bro ๐
Thank’s Bro… It Works for me
Thanks a ton Ramya. This worked like Magic !
Very helpfull and solved my error! AM very greatful…
This saved my day and week and month and year ๐
Thanks so much! It works
Thank you. It works for me
Fix Failed to download metadata for repo
Should perhaps also include the alternative of switching to AlmaLinux.
We have provided migration of CentOS 8 to Rocky Linux. Next, we shall provide migration of CentOS to AlmaLinux. Thanks for your feedback.
awesome, thanks
thx bro.
Thanks. This worked
Thank you, i appreciate very helpful
useful. thank you
thanks
Good for configure centos 8
Many Thanks
This was a big help, thanks. Unfortunately, while it also fixed the software application in CentOS, that is virtually devoid of applications to install. I don’t know if that’s due to CentOS being all but decommissioned in favor of the newer stream releases, or some other reason. I’ve worked with a lot of commercial UNIX systems (nothing actually fun like Linux), but I installed CentOS 8 just to follow along with a Redhat certification course while I wait for the Redhat Export Hold to be removed from my account (if that ever happens). Thanks again for the help!
Thanks
Tks! Very good explanation!
very good.
thnx!
This was exactly the article I needed. No recommendations for improvement. Thanks so much!
Thank you for your solution.. it saved me..
Very usefull
Thanks Verrrrry much
thanks
ty
Perfect thanx !!
Thank you. All fixed
Many thanks
Merci, problรจme rรฉsolu en quelques minutes grรขce ร vous !
Thanks!
Thanks useful info
Thanks useful info
Isn’t that easier to do?
Connecting the CentOS Stream repository:
# dnf install centos-release-stream
Specify the new repository as default:
# dnf swap centos-{linux,stream}-repos
Synchronizing installed packages:
# dnf distro-sync
It worked fine smooth
Perfect so easy Thank you so much!!!!
Thank you.
Works
Thanks
nice
Tks
Thanks, you saved the day
# cat /etc/redhat-release
CentOS Linux release 8.5.2111
I am ending up below error . Appreciate your support
yum update -y
CentOS Linux 8 – AppStream 0.0 B/s | 0 B 00:04
Errors during downloading metadata for repository ‘appstream’:
– Curl error (60): Peer certificate cannot be authenticated with given CA certificates for https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [SSL certificate problem: self signed certificate in certificate chain]
Error: Failed to download metadata for repo ‘appstream’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
The error might be because the standard root CAs werenโt installed, meaning that yum couldnโt verify the SSL certificates of HTTPS site.
install the ca-certificates bundle and update the ca-trust as below:
[root@vmforpbs ~]# yum install -y ca-certificates
[root@vmforpbs ~]# update-ca-trust force-enable
Refrence: https://techglimpse.com/git-clone-fatal-error-problem-ssl-ca-cert/
Just brillient
thanks
appreciate a lot
It was helpful .. Thank you !!
Thanks a lot
Super, thanks! Easy and strait.
thanks it works
Sending thanks and positive vibes your way.
Great job thank you I ran into this issue today (2/15/22) and your steps worked perfectly.
Awesome! helpful!
Thx a lot, that helped!
problem solved. Many Thanks
Thank you such mich this was a real help ๐ Thank you
This solution worked like charm . But when tried after few days on same CentOS 8.0 , I get below Error . Did anyone else faced this
[root@master-node ~]# dnf update -v
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
error: Curl error (28): Timeout was reached for https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml [Operation timed out after 30000 milliseconds with 0 out of 0 bytes received] (https://vault.centos.org/centos/8/AppStream/x86_64/os/repodata/repomd.xml).
CentOS-8 – AppStream 0.0 B/s | 0 B 00:52
Cannot download ‘http://vault.centos.org/centos/8/AppStream/x86_64/os/’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried.
Failed to download metadata for repo ‘AppStream’
Error: Failed to download metadata for repo ‘AppStream’
Check with the link: http://vault.centos.org/centos/8/AppStream/x86_64/os/ from the server.
I am getting the same error. Were you able to get it resolved ?
Reference https://serverfault.com/questions/1093922/failing-to-run-yum-update-in-centos-8 . I ran into this and vault.centos.org was super flaky and using vault.epel.cloud instead fixed it.
This works for my VM thanks
Finally someone telling us what to do instead of sending us towards a blind alley like most are doing on stackoverflow. Thanks mate!
thank you, solved
thanks
This works for me. Thanks a lot
Thankls.
problem solved. Many Thanks
thx, I already wondered why ‘yum update’ no longer wordked.
This solved the problem! Thanks!
Thanks for saving my time!. I was going to install centos 8.5.
Thank you for the sed commands to rewire the repos to the vault. What a time saver.
Worked like a charm. Thanks!
great
Thank You. This worked.
Tks Ramya! Your article was indeed helpful to solve my problem.
Hero of the night. Works as intended.
CentOS only needs to make it couple more days now until Debian makes a return to my machines. But the update(s) could not wait.
did not fix the issue. Same crap!
thank you
Extremely helpful. Solved my issue
thank you,this is useful!
thank you alots,this help me
perfectly work!
So helpful. Thank you!
Thanks for the tip Ramya.
I’ts working.Thx
thank’s your kindness.
Helpful?
Thanks a lot. That helped me a lot. and makes me be sure to migrate to another OS, based on CentOS (Rocky??)
great it’s very helpfull
Thanks friend.
Thank You!
helped for update
Short and straightforward ! ๐
Thanks a lot. It worked for me.
thank you it is working
Work for me. Thnx alot
super
Thanks man!
Work smooth , thanks
Clear and concise. What the problem was; why it occurred; what to do. Thanks!
Helped a lot, thanks!
This works for me for Stream 8 on a USB boot flash disk.
I take it back. cat /etc/centos-release shows 8.5.2111. I’m guessing I won’t need this fix when I actually get Stream 8 installed correctly. -jcr