新安装的 AlmaLinux 8 无法安装任何软件包,都会报错:Error: GPG check FAILED
。
复现
使用 AlmaLinux 8.3 镜像重新安装即可复现问题,完整报错如下
AlmaLinux 8 - BaseOS 3.3 MB/s | 3.4 kB 00:00
Importing GPG key 0xC21AD6EA:
Userid : "AlmaLinux <packager@almalinux.org>"
Fingerprint: E53C F5EF 91CE B0AD 1812 ECB8 51D6 647E C21A D6EA
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Is this ok [y/N]: y
Key imported successfully
Import of key(s) didn't help, wrong key(s)?
AlmaLinux 8 - AppStream 3.3 MB/s | 3.4 kB 00:00
Importing GPG key 0xC21AD6EA:
Userid : "AlmaLinux <packager@almalinux.org>"
Fingerprint: E53C F5EF 91CE B0AD 1812 ECB8 51D6 647E C21A D6EA
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Is this ok [y/N]: y
Key imported successfully
Import of key(s) didn't help, wrong key(s)?
Public key for emacs-filesystem-26.1-15.el8_10.noarch.rpm is not installed. Failing package is: emacs-filesystem-1:26.1-15.el8_10.noarch
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-Errno-1.28-423.el8_10.x86_64.rpm is not installed. Failing package is: perl-Errno-1.28-423.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-HTTP-Tiny-0.074-3.el8.noarch.rpm is not installed. Failing package is: perl-HTTP-Tiny-0.074-3.el8.noarch
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-IO-1.38-423.el8_10.x86_64.rpm is not installed. Failing package is: perl-IO-1.38-423.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-interpreter-5.26.3-423.el8_10.x86_64.rpm is not installed. Failing package is: perl-interpreter-4:5.26.3-423.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-libs-5.26.3-423.el8_10.x86_64.rpm is not installed. Failing package is: perl-libs-4:5.26.3-423.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-macros-5.26.3-423.el8_10.x86_64.rpm is not installed. Failing package is: perl-macros-4:5.26.3-423.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for git-2.43.7-1.el8_10.x86_64.rpm is not installed. Failing package is: git-2.43.7-1.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for git-core-2.43.7-1.el8_10.x86_64.rpm is not installed. Failing package is: git-core-2.43.7-1.el8_10.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for git-core-doc-2.43.7-1.el8_10.noarch.rpm is not installed. Failing package is: git-core-doc-2.43.7-1.el8_10.noarch
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
Public key for perl-Git-2.43.7-1.el8_10.noarch.rpm is not installed. Failing package is: perl-Git-2.43.7-1.el8_10.noarch
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: GPG check FAILED
解决
查找资料后发现 AlmaLinux 官方在 2023 年末发布过一篇文章,指出内置证书即将过期,后续会更新 GPG 证书链,所以使用下面的命令导入新证书即可解决:
sudo -i
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
导入成功后可以检查一下证书指纹,防止中间人攻击。
rpm -q gpg-pubkey-ced7258b-6525146f
同时这个密钥也会跟随 AlmaLinux 8.8 版本进行分发,所以如果安装的系统在 8.8 版本之前都需要手动导入一下新密钥,防止出现更新问题和安全隐患。
附录
参考链接
- Alma linux 8 update fails for any package with GPG keys check fail - StackExchange
- AlmaLinux 8 GPG key change - AlmaLinuxOS News
本文由 柒 创作,采用 知识共享署名4.0
国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间: 2025-10-07 17:44 PM