Upgrade

pacman -Syyu 錯誤:無法從受信任的使用者導入密鑰

  • January 16, 2022

DISTRIB_ID = ManjaroLinux

DISTRIB_RELEASE=17.1.6

DISTRIB_CODENAME = Hakoila

我今天在一台舊筆記型電腦上安裝了 manjaro,並且正在嘗試更新它。

只是使用pacman -Syyu最終給了我

(383/383) checking keys in keyring
downloading required keys...
:: Import PGP Key KEY, "Brad Fanella <cesura@archlinux.org>", 
created: 2018-03-2? [Y/n] Y
error: key "Brad Fanella <cesura@archlinux.org>" could not be imported
error: required key missing from keyring
error: failed to commit transaction (unexpected error)

我嘗試了這個序列,但無濟於事:

sudo pacman-key --init
sudo pacman-key --populate archlinux manjaro
sudo pacman-key --refresh-keys
sudo pacman -Syy
sudo pacman -S manjaro-keyring archlinux-keyring
sudo pacman -Syyu

有任何想法嗎?

編輯 1

嘗試pacman-key --recv-keys F382BBBD並得到了這個:

gpg: key 81A402D4F382BBBD was created 6 days in the future (time warp or clock problem)
gpg: key 81A402D4F382BBBD: no valid user IDs
gpg: this may be caused by a missing self-signature
gpg: Total number processed: 1
gpg:           w/o user IDs: 1

解決了。

EDIT 1輸出,

我使用更新了時鐘sudo ntpdate -vu time.nist.gov

然後pacman-key --recv-keys F382BBBD瞧。

那簡單得令人討厭。

以下內容適用於 archlinux,但也適用於其他 Linux 發行版。要更正無效的 KEY,需要執行以下操作:

rm -fr /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux

說引發錯誤的關鍵是在 Blackarch 中,那麼還需要:

sudo pacman-key --populate blackarch

最後

sudo pacman -Sy archlinux-keyring
sudo pacman-key --populate archlinux
sudo pacman-key --refresh-keys

引用自:https://unix.stackexchange.com/questions/445788