It`s simple when you know how ! CentOS,Linux,Tutorials Linux CentOS can not get updates from REPO

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 “vault.centos.org” , 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=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

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

[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://#mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=http://vault.epel.cloud/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Now you will be able to execute :

yum update
Or
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 *

Related Post