Fedora Server 38 Beta版DNF工具GPG校验失败及软件包打开异常求助
Fedora Server 38 Beta版DNF工具GPG校验失败及软件包打开异常求助
你遇到的情况是Fedora 38上DNF工具完全无法正常执行安装/升级操作,具体表现为下载软件包后提示大量Problem opening package错误,最终触发GPG check FAILED,且执行dnf clean all无效,查询GPG公钥时还出现签名损坏的提示:
Total 685 kB/s | 1.2 MB 00:01 Problem opening package avahi-glib-0.8-22.fc38.x86_64.rpm Problem opening package avahi-libs-0.8-22.fc38.x86_64.rpm Problem opening package cmake-3.26.3-1.fc38.x86_64.rpm Problem opening package cmake-data-3.26.3-1.fc38.noarch.rpm Problem opening package cmake-filesystem-3.26.3-1.fc38.x86_64.rpm Problem opening package cmake-rpm-macros-3.26.3-1.fc38.noarch.rpm Problem opening package dnsmasq-2.89-2.fc38.x86_64.rpm Problem opening package firewalld-1.3.1-1.fc38.noarch.rpm Problem opening package firewalld-filesystem-1.3.1-1.fc38.noarch.rpm Problem opening package grub2-common-2.06-95.fc38.noarch.rpm Problem opening package grub2-pc-2.06-95.fc38.x86_64.rpm Problem opening package grub2-pc-modules-2.06-95.fc38.noarch.rpm Problem opening package grub2-tools-2.06-95.fc38.x86_64.rpm Problem opening package grub2-tools-minimal-2.06-95.fc38.x86_64.rpm Problem opening package gstreamer1-1.22.2-1.fc38.x86_64.rpm Problem opening package gstreamer1-plugins-bad-free-1.22.2-1.fc38.x86_64.rpm Problem opening package gstreamer1-plugins-base-1.22.2-1.fc38.x86_64.rpm Problem opening package gstreamer1-plugins-good-1.22.2-1.fc38.x86_64.rpm Problem opening package langpacks-core-en-3.0-32.fc38.noarch.rpm Problem opening package langpacks-core-font-en-3.0-32.fc38.noarch.rpm Problem opening package langpacks-core-font-ja-3.0-32.fc38.noarch.rpm Problem opening package langpacks-core-font-uk-3.0-32.fc38.noarch.rpm Problem opening package langpacks-core-ja-3.0-32.fc38.noarch.rpm Problem opening package langpacks-core-uk-3.0-32.fc38.noarch.rpm Problem opening package langpacks-en-3.0-32.fc38.noarch.rpm Problem opening package langpacks-ja-3.0-32.fc38.noarch.rpm Problem opening package langpacks-uk-3.0-32.fc38.noarch.rpm Problem opening package libxml2-2.10.4-1.fc38.x86_64.rpm Problem opening package polkit-122-3.fc38.1.x86_64.rpm Problem opening package polkit-libs-122-3.fc38.1.x86_64.rpm Problem opening package python3-firewall-1.3.1-1.fc38.noarch.rpm Problem opening package python3-libxml2-2.10.4-1.fc38.x86_64.rpm Problem opening package qt5-qtbase-5.15.9-1.fc38.x86_64.rpm Problem opening package qt5-qtbase-common-5.15.9-1.fc38.noarch.rpm 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
执行rpm -qa gpg-pubkey\*时返回:
error: rpmdbNextIterator: skipping h# 13 Header V4 RSA/SHA256 Signature, key ID eb10b464: BAD Header SHA256 digest: OK Header SHA1 digest: OK
这种问题基本是RPM数据库损坏和GPG公钥失效/损坏导致的,下面是一步步的解决办法:
一、修复损坏的RPM数据库
RPM数据库是DNF依赖的核心数据库,一旦损坏就会出现软件包读取异常:
- 先关闭所有可能占用RPM数据库的服务:
sudo systemctl stop dnf-makecache.timer packagekit.service - 备份当前的RPM数据库(安全起见,万一修复失败可以恢复):
sudo cp -r /var/lib/rpm /var/lib/rpm.backup - 重建RPM数据库:
sudo rpm --rebuilddb
二、重新导入Fedora官方GPG密钥
GPG校验失败是因为系统无法验证软件包的签名,重新导入官方密钥即可:
- 先卸载已损坏的对应密钥(报错里的密钥ID是
eb10b464):sudo rpm -e gpg-pubkey-eb10b464-* - 导入Fedora 38的官方x86_64架构密钥:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-38-x86_64
三、清理缓存并重试DNF操作
完成上面两步后,清理DNF的所有缓存并强制刷新仓库后执行升级:
sudo dnf clean all sudo dnf upgrade --refresh
如果执行后还是有部分软件包报错,可以尝试强制重新安装这些软件包,比如将报错的包名依次列出执行:
sudo dnf reinstall avahi-glib avahi-libs cmake cmake-data ...
备注:内容来源于stack exchange,提问作者Олег Пона
相关产品推荐
相关产品推荐

