Fix Rocky 9 dnf "repomd.xml GPG signature verification error"
Rocky 9 dnf "repomd.xml GPG signature verification error: Bad GPG signature" means metadata and signature do not match. Run dnf clean all, then suspect a proxy.
Error: Failed to download metadata for repo 'baseos': repomd.xml GPG signature verification error: Bad GPG signatureThe repository index repomd.xml that dnf downloaded does not match the signature it downloaded with it (repomd.xml.asc). Either one of them is stale (cache, mirror), it was changed on the way (proxy), or there is a signing problem on the distribution side. Run sudo dnf clean all and retry first; if it persists, look at your proxy and at announcements. Turning signature checks off is a last, temporary step.
This check only runs with repo_gpgcheck=1. It is separate from package signature checks (gpgcheck):
| Setting | What is verified |
|---|---|
gpgcheck=1 | the signature of each downloaded package (.rpm) |
repo_gpgcheck=1 | the signature of the repository metadata repomd.xml — this error |
[1] Find where repo_gpgcheck is turned on. Rocky 9's stock rocky.repo has no such line (both the 9.3 image and the latest rocky-repos 9.8 package in 2026-10 only set gpgcheck=1). If baseos still gives this error, someone turned it on globally:
$ grep -rn repo_gpgcheck /etc/dnf/dnf.conf /etc/yum.repos.d/If it was enabled on purpose for a security baseline, leave it. The setting is right; the problem is the downloaded files.
[2] Clear the cache and download again. A cached old repomd.xml mixed with a new signature, or a half-synced mirror, makes the signature fail.
$ sudo dnf clean all$ sudo dnf makecache --refreshReproducing it shows the mechanism. Changing one character in a local repository's repomd.xml after signing produced the same error, and re-signing to match fixed it:
Error: Failed to download metadata for repo 'lab': repomd.xml GPG signature verification error: Bad GPG signatureAnother option is to retry with only baseos and appstream enabled, which one forum answer suggested:
$ sudo dnf --disablerepo='*' --enablerepo=baseos,appstream makecache[3] If you go through a company proxy or security appliance, suspect it. A user who hit this after upgrading from 9.6 to 9.7 checked time sync and then fixed it by switching to a different proxy, according to the forum thread. You can check whether the files the server receives are the originals: download both over the same path (same proxy) and verify with the official Rocky key.
$ U=https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/repodata$ curl -s -o repomd.xml $U/repomd.xml && curl -s -o repomd.xml.asc $U/repomd.xml.asc$ export GNUPGHOME=$(mktemp -d)$ gpg -q --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9$ gpg --verify repomd.xml.asc repomd.xmlgpg: Signature made …gpg: using RSA key 21CB256AE16FC54C6E652949702D426D350D275Dgpg: Good signature from "Rocky Enterprise Software Foundation - Release key 2022 <releng@rockylinux.org>" [unknown]Good signature means the files that reached you over that path are intact. BAD signature means a file was changed in transit; ask whoever runs the proxy not to cache or modify that address. [unknown] only means the temporary keyring does not mark the key as trusted. Check that the key ID ending in 350D275D matches the Rocky 9 key shown by rpm -q gpg-pubkey (gpg-pubkey-350d275d-…).
[4] If all of that checks out and many servers fail at once, the problem may be upstream. On 2026-03-20 this error was posted on the forum, and other users reported it on several servers. A reply said the infrastructure side was looking into it, and on 03-24 a reply said it "should be resolved now" and suggested dnf clean all before retrying (the responder's role was not visible). In that situation, watch the Rocky Linux forum and wait.
$ sudo dnf --setopt=baseos.repo_gpgcheck=0 makecacheIn testing this command went through, the repo_gpgcheck=1 line in the file stayed, and the next run after clearing the cache checked again and failed the same way. Metadata fetched without verification stays in the cache, so once the problem is gone run sudo dnf clean all and fetch again with checks on.
Failures to download the signature file at all, such as Status code: 404 or GPG signature is not available, have a different cause — see Fix "Failed to download metadata for repo" in dnf on Rocky 9.