Site icon GetPageSpeed

How to fix dnf after CentOS 8 went EOL

It’s the year 2022 and RedHat has stopped the development of CentOS 8 by removing packages from its primary servers.
Essentially, RedHat first took over CentOS, then deprecated it.

If for whatever reason, you are stuck with the now EOL version of the CentOS operating system, you can no longer run the dnf upgrade successfully. Running dnf upgrade in CentOS 8 will yield the following results:

CentOS Linux 8 – AppStream 514 B/s | 38 B 00:00
Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist

Exited with code exit status 1

The following commands point to the Cloudflare-based vault repository, which makes dnf work again.

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-*

The vault.epel.cloud is more reliable than vault.centos.org, which has severe downtime issues.

The right thing to do now is to upgrade to Rocky Linux 8. If you don’t have any bad packages installed, upgrading is pretty easy:

dnf -y upgrade
curl https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh -o migrate2rocky.sh
chmod u+x migrate2rocky.sh
./migrate2rocky.sh -r
reboot

Verify that you are running Rocky Linux 8 using cat /etc/redhat-release.

Want to say thanks?

Exit mobile version