Linux CentOS can not get updates from REPO

Somtime the linux machine can not get updates and you get this error:

"Failed to download metadata for repo AppStream"

This can happens if the repo URL is old or got corrupted some how, To fix this just replace the URL with a good and updated one like “” , run from ssh or console :

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-*

This is example of how CentOS-Linux-BaseOS.repo :

name=CentOS Linux $releasever - BaseOS

Now you will be able to execute :

yum update
dnf update

Some time you will need to run “clean all” to reset the package list:

yum clean all

I had an indecent with this error :

Module yaml error: Unexpected key in data: static_context [line 9 col 3]

The solution is simple, just upgrade the module:

dnf update libmodulemd

Now run again the update

Good Luck

Leave a Reply

Your email address will not be published. Required fields are marked *