Failed to download metadata for repo 🐧 Linux

Error: Failed to download metadata for repo 'appstream' (dnf / yum)

dnf/yum can’t fetch a repository’s metadata — the mirror is unreachable, the repo URL is dead (CentOS 8 EOL), or there’s a DNS/proxy problem.

Seen on: Linux

Meaning

CentOS 8 reached end of life and its mirrors moved to vault.centos.org, breaking every repo. Other causes are network/proxy issues, expired repo GPG/SSL, or a typo in a .repo file.

Common causes

  • CentOS 8 / Stream 8 end-of-life (mirrorlist gone)
  • No network/DNS or proxy not configured for dnf
  • Broken third-party .repo file
  • Clock skew breaking HTTPS

⚡ Quick fix

  1. Migrate to a supported OS (Rocky/Alma/Stream 9) or point repos at vault.centos.org
  2. Check connectivity/proxy in /etc/dnf/dnf.conf
  3. Disable the broken repo: dnf --disablerepo=<id>

Detailed fix by platform

RHEL

  1. bash
    sudo dnf clean all
    sudo dnf repolist -v
    sudo sed -i 's/mirrorlist/#mirrorlist/; s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|' /etc/yum.repos.d/CentOS-*.repo   # CentOS 8 only

How to diagnose

  1. OS — cat /etc/os-release (EOL?)
  2. Network — curl -I the repo URL
  3. Repo — Which repo id fails?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.