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

When updating packages on CentOS 8 server, I got the following error

[root@instance-20220409-2340 ~]# dnf update
Failed loading plugin "osmsplugin": No module named 'librepo'
CentOS Linux 8 - AppStream                                                                                                                                                  51  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@instance-20220409-2340 ~]#

This is because CentOS 8 have reached its End of life.

To fix the dnf error, you can change the repository baseurl to vault.centos.org

Advertisement

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

You may need to convert CentOS 8 to one of the supported Linux distributions.

Convert CentOS 8 to CentOS 8 Stream

To convert CentOS 8 to CentOS 8 Stream, run

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

C

Convert CentOS 8 to RHEL 8

RedHat provides Convert2RHEL script to convert CentOS 8 to RHEL 8. RHEL is now FREE for production up to 16 servers.

Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement