Fix yum that will not update

We'll check connectivity, repo config, disk space, and locks—then fix repo URLs, GPG keys, or metadata—or tell you when to escalate.

Category
Troubleshooting · Servers & Linux
Time
10–25 min
Last reviewed
What you'll need
  • SSH or console access with sudo

Step-by-step diagnostic

Step 1 of 11
Show full guide

Steps

Goal: Check connectivity, repo config, disk space, and locks—then fix repo URLs, GPG keys, or metadata.

  • Run sudo yum update or sudo yum check-update. Note the exact error.
  • Good: You see a specific error (connection, 404, GPG, disk full, lock). Proceed to Check connectivity.
  • Bad: yum hangs—check connectivity and timeouts.

Check error and connectivity

Goal: Confirm the error and test repo reachability.

  • Run yum repolist and inspect /etc/yum.repos.d/*.repo for baseurl or mirrorlist.
  • Test with curl -I <baseurl> or ping the host. If unreachable, the repo URL or mirror is wrong.
  • Run df -h and confirm / and /var have free space. yum needs space in /var/cache/yum.
  • Good: Repo is reachable and disk has space. Proceed to Fix repo config if needed, or Clear metadata.
  • Bad: Repo unreachable or disk full—fix the repo URL or free space first.

Fix repo config

Goal: Fix baseurl or mirrorlist so yum can reach the repo.

  • Edit the .repo file in /etc/yum.repos.d/. Set baseurl to a known-good mirror (e.g. vault.centos.org for old CentOS). Check that enabled=1.
  • Run sudo yum clean all and sudo yum makecache. Retry sudo yum update.
  • If the error is GPG-related, import the key with sudo rpm --import <key-url> or temporarily set gpgcheck=0 to test—do not leave disabled in production.
  • Good: Metadata loads and packages update. Bad: Same error—check connectivity again or escalate.

Clear metadata

Goal: Remove corrupted metadata and retry.

  • Run sudo yum clean all to clear cached metadata. Then sudo yum makecache and sudo yum update.
  • Good: Update succeeds. Bad: Escalate with the error and repo config.

When to escalate

Escalate if:

  • The repo is managed by a central team and you cannot change it.
  • The mirror is enterprise-internal and unreachable from your network.
  • The fix requires network or firewall changes outside your control.

Provide: the yum error, yum repolist output, and contents of /etc/yum.repos.d/*.repo.

Verification

  • sudo yum update or sudo yum check-update completes without errors.
  • Packages install or update successfully.
  • No GPG or connection errors in the output.

Escalation ladder

Work from the device outward. Stop when the problem is fixed.

  1. Capture error Run yum update; note exact error.
  2. Connectivity and disk Test repo URL with curl; check df -h.
  3. Repo config Edit baseurl/mirrorlist; yum clean all; makecache.
  4. GPG keys Import correct key or temporarily disable gpgcheck to test.
  5. Escalate Enterprise-managed repo or infrastructure change needed.

What to capture if you need help

Before calling support or posting for help, have these ready. It speeds everything up.

  • Exact yum error message
  • Output of yum repolist
  • Contents of /etc/yum.repos.d/*.repo
  • df -h and disk usage

Does yum update show a specific error?

Run sudo yum update and note the error: connection, 404, GPG, disk full, or lock.

Run `sudo yum update`. Good: You see a specific error (connection refused, 404, GPG, disk full, lock). Bad: yum hangs with no output—check connectivity and timeouts.

You can change your answer later.

Check connectivity and timeouts

Test repo URL with `curl -I <baseurl>` or `ping` the host. If unreachable, fix network or use a different mirror. Check `df -h` for full disk.

Can you reach the repo URL?

Test with curl -I or ping. Repo must return HTTP 200 or be reachable.

Run `yum repolist` and check baseurl/mirrorlist in `/etc/yum.repos.d/`. Test with `curl -I <url>`. Good: HTTP 200 or host reachable. Bad: Timeout or 404—fix repo URL or mirror.

You can change your answer later.

Fix repo URL and retry

Edit the .repo file in `/etc/yum.repos.d/`. Set baseurl to a known-good mirror (e.g. vault.centos.org for old CentOS). Run `yum clean all` and `yum makecache`. Retry `yum update`.

Is disk space sufficient?

yum needs space in /var and /var/cache/yum.

Run `df -h`. Check `/` and `/var`. Good: At least a few percent free. Bad: Near 100%—free space or expand volume. See fix-linux-runs-out-of-disk.

You can change your answer later.

Is another yum process holding the lock?

Only one yum process can run at a time.

Run `ps aux | grep -E "yum|dnf"` and check `/var/run/yum.pid`. Good: No other process or stale lock. Bad: Another admin is running updates—wait, or kill only if you are sure it is stale.

You can change your answer later.

Wait or remove stale lock

If another admin is updating, wait. If the lock is stale (no process), remove the pid file and retry. Check with `ls -la /var/run/yum.pid`.

Is the error GPG-related?

GPG key retrieval failed or GPG check failed.

Import the correct key: `sudo rpm --import https://mirror.example.com/RPM-GPG-KEY`. Or temporarily set gpgcheck=0 in the repo to test—do not leave disabled in production. Good: Update succeeds. Bad: Other error—check metadata with `yum clean all` and `yum makecache`.

You can change your answer later.

Import GPG key and retry

Get the correct key from the repo or distro docs. Run `sudo rpm --import <key-url>`. Retry `yum update`.

Clear metadata and retry

Run `sudo yum clean all`, then `sudo yum makecache` and `sudo yum update`. Corrupted metadata can cause odd failures.

Escalate

Escalate if the repo is enterprise-managed, you cannot change infrastructure, or disk cannot be expanded. Provide yum error, repolist output, and repo config.

Reviewed by Blackbox Atlas

Frequently asked questions

Why would yum update fail?
Network or repo URL unreachable, expired or wrong GPG key, full disk, another yum/dnf process holding the lock, or corrupted metadata. Check the error message first.
Can I fix yum update myself?
Yes. Check connectivity, repo config, disk space, and locks. Fix baseurl, import GPG keys, clear metadata with yum clean all, or remove stale lock files.
When should I escalate yum update failures?
If the repo is enterprise-managed and you cannot change it, or the fix requires infrastructure changes outside your control.

Rate this guide

Was this helpful?

Thanks for your feedback.

Continue to