由于缺少密钥,我目前在安装软件包时遇到问题。我的第一个计划是更新我的密钥环,但是“pacman-key --refresh-keys”失败:
[user@hostname ~]$ sudo pacman-key --refresh-keys
gpg: refreshing 134 keys from hkp://pool.sks-keyservers.net
gpg: keyserver refresh failed: Permission denied
==> ERROR: A specified local key could not be updated from a keyserver.
还尝试在“su”下运行它。
[user@hostname ~]$ su
Password:
[root@hostname user]# pacman-key --refresh-keys
gpg: refreshing 134 keys from hkp://pool.sks-keyservers.net
gpg: keyserver refresh failed: Permission denied
==> ERROR: A specified local key could not be updated from a keyserver.
尝试手动运行 dirmngr 以查看是否有任何错误。
[user@hostname ~]$ sudo dirmngr < /dev/null
dirmngr[25316]: error opening '/root/.gnupg/dirmngr_ldapservers.conf': No such file or directory
dirmngr[25316.0]: permanently loaded certificates: 141
dirmngr[25316.0]: runtime cached certificates: 0
dirmngr[25316.0]: trusted certificates: 141 (140,0,0,1)
# Home: /root/.gnupg
# Config: [none]
OK Dirmngr 2.2.3 at your service
我注意到 Arch Linux 论坛上提到过“打开‘/root/.gnupg/dirmngr_ldapservers.conf’时出错”。所以我创建了一个空白的“/root/.gnupg/dirmngr_ldapservers.conf”并再次运行dirmngr。如果我在没有 sudo 的情况下运行 dirmngr,我也会遇到类似的错误,因此我也创建了一个空白的“/home/user/.gnupg/dirmngr_ldapservers.conf”。
[user@hostname ~]$ sudo dirmngr < /dev/null
dirmngr[28763.0]: permanently loaded certificates: 141
dirmngr[28763.0]: runtime cached certificates: 0
dirmngr[28763.0]: trusted certificates: 141 (140,0,0,1)
# Home: /root/.gnupg
# Config: [none]
OK Dirmngr 2.2.3 at your service
[user@hostname ~]$ dirmngr < /dev/null
dirmngr[32757.0]: permanently loaded certificates: 141
dirmngr[32757.0]: runtime cached certificates: 0
dirmngr[32757.0]: trusted certificates: 141 (140,0,0,1)
# Home: /home/user/.gnupg
# Config: [none]
OK Dirmngr 2.2.3 at your service
删除两个“.gnupg”文件夹,运行“pacman-key --init”,然后尝试“pacman-key --refresh-keys”。
[user@hostname ~]$ sudo rm -rf /root/.gnupg
[user@hostname ~]$ sudo rm -rf /home/user/.gnupg
[user@hostname ~]$ sudo pacman-key --init
[user@hostname ~]$ sudo pacman-key --refresh-keys
gpg: refreshing 134 keys from hkp://pool.sks-keyservers.net
gpg: keyserver refresh failed: Permission denied
==> ERROR: A specified local key could not be updated from a keyserver
删除两个“.gnupg”目录后,我再次运行 dirmngr。
[user@hostname ~]$ dirmngr --debug-level guru
dirmngr[18151]: enabled debug flags: x509 crypto memory cache memstat hashing ipc dns network lookup extprog
dirmngr[18151]: error opening '/home/user/.gnupg/dirmngr_ldapservers.conf': No such file or directory
dirmngr[18151.0]: permanently loaded certificates: 141
dirmngr[18151.0]: runtime cached certificates: 0
dirmngr[18151.0]: trusted certificates: 141 (140,0,0,1)
dirmngr[18151.0]: failed to open cache dir file '/home/user/.gnupg/crls.d/DIR.txt': No such file or directory
dirmngr[18151.0]: creating directory '/home/user/.gnupg'
dirmngr[18151.0]: creating directory '/home/user/.gnupg/crls.d'
dirmngr[18151.0]: new cache dir file '/home/user/.gnupg/crls.d/DIR.txt' created
dirmngr[18151.0]: DBG: chan_3 -> # Home: /home/user/.gnupg
# Home: /home/user/.gnupg
dirmngr[18151.0]: DBG: chan_3 -> # Config: [none]
# Config: [none]
dirmngr[18151.0]: DBG: chan_3 -> OK Dirmngr 2.2.3 at your service
OK Dirmngr 2.2.3 at your service
现在我完全陷入困境了。我怀疑 GPG 所需的文件可能存在某种权限问题,但考虑到我已经删除了两个“.gnupg”目录并且它们已重新生成,我看不出有什么问题。
我也尝试过此维基页面上的所有内容:https://wiki.parabola.nu/Parabola_Keyring一切正常,包括“sudo pacman-key --populate archlinux archlinux32 archlinuxarm parabola”命令,但“pacman-key --refresh-keys”仍然给了我权限错误。
刚刚尝试直接使用 gpg 刷新我的密钥环:
[user@hostname ~]$ sudo gpg2 --refresh-keys
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
然后尝试使用 pacman-key 来做到这一点:
[user@hostname ~]$ sudo pacman-key --refresh-keys
gpg: refreshing 135 keys from hkp://pool.sks-keyservers.net
gpg: keyserver refresh failed: Permission denied
==> ERROR: A specified local key could not be updated from a keyserver.
所以失败了。尝试使用 gpg2 看看输出是否相同:
[user@hostname ~]$ sudo gpg2 --refresh-keys
没有任何输出,所以我怀疑它创建的文件与我当前的问题有关。
作为最后的努力,我尝试不使用 sudo,但没有得到任何输出:
[user@hostname ~]$ gpg2 --refresh-keys
仍然坚持这一点。甚至安装了 kgpg 来手动生成 gpg 的配置文件。但是,我仍然遇到这个该死的权限错误。
答案1
在 ~/.gnupg/gpg.conf 中切换密钥服务器,当前定义的密钥服务器很可能是 404