Rocky 9 "Hash algorithm SHA1 not available": third-party repos
Rocky 9 "Hash algorithm SHA1 not available" means a third-party package is signed with SHA-1. Get the vendor's new key before you lower the crypto policy.
Key imported successfullywarning: Signature not supported. Hash algorithm SHA1 not available.Import of key(s) didn't help, wrong key(s)?Problem opening package tree-1.8.0-10.el9.x86_64.rpm. Failing package is: tree-1.8.0-10.el9.x86_64 GPG Keys are configured as: file:///srv/old-vendor.ascError: GPG check FAILEDThe third-party package is signed with SHA-1, and Rocky Linux 9's default crypto policy (DEFAULT) does not verify that signature. The key went in (Key imported successfully), but the signature cannot be checked, so the install stops. The proper fix is a key and packages the vendor re-signed with SHA-256 or better; lowering the system policy weakens security and is the last resort.
The RHEL 9 release notes say "The usage of the SHA-1 message digest for cryptographic purposes has been deprecated in RHEL 9" and "The use of SHA-1 for signatures is restricted in the DEFAULT crypto policy." Rocky 9 uses the same policies. A 2022 Rocky 9 forum post reports the failure earlier, at key import (key 1 import failed). With the rpm version tested here (4.16.1.3), importing a SHA-1-signed key succeeded and the failure came at package signature verification.
[1] Confirm SHA-1 is the cause. Check the current policy and the hash used in the package signature:
$ update-crypto-policies --showDEFAULT$ rpm -Kv tree-1.8.0-10.el9.x86_64.rpmwarning: Signature not supported. Hash algorithm SHA1 not available. Header V4 RSA/SHA1 Signature, key ID 579b0b3c: BAD Header SHA256 digest: OKRSA/SHA1 Signature together with Hash algorithm SHA1 not available is this case. The digest lines say OK, so the file itself is intact. A package signed by the same key with SHA-256 passed under the same policy: Header V4 RSA/SHA256 Signature, key ID 579b0b3c: OK.
[2] Look for the vendor's new key or updated repository setup. Check whether the .repo file and gpgkey URL in the vendor's install guide changed; if so, import the new key and remove the old one:
$ rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'$ sudo rpm --import https://vendor.example.com/new-key.asc$ sudo rpm -e gpg-pubkey-<old-key-version>-<release>If the vendor still signs only with SHA-1, tell their support that signatures do not verify on RHEL 9-family systems. In the 2022 forum case, the poster did not lower the policy, asked the vendor to change the key, and later reported that the vendor planned to.
[3] If you cannot wait, the official docs give a subpolicy that re-allows SHA-1 verification:
$ sudo update-crypto-policies --set DEFAULT:SHA1In the test container, switching to DEFAULT:SHA1 made the same package pass with digests signatures OK, and switching back to DEFAULT returned SIGNATURES NOT OK. Packages already installed keep working after you switch back, but the next update hits the same error, so use it only as a stopgap until step 2 is solved.
Repository metadata signature errors (repomd.xml) are a different problem — see Fix Rocky 9 dnf "repomd.xml GPG signature verification error". If the package cannot be found at all, see Fix Rocky 9 dnf "Error: Unable to find a match".