
最近,apt update && apt full-upgrade
我在隨後運行時開始收到以下錯誤apt full-upgrade
:
Get:4 https://repo.skype.com/deb stable InRelease [4,502 B]
Err:4 https://repo.skype.com/deb stable InRelease
The following signatures were invalid: EXPKEYSIG 1F3045A5DF7587C3 Skype Linux Client Repository <[email protected]>
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://repo.skype.com/deb stable InRelease: The following signatures were invalid: EXPKEYSIG 1F3045A5DF7587C3 Skype Linux Client Repository <[email protected]>
W: Failed to fetch https://repo.skype.com/deb/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG 1F3045A5DF7587C3 Skype Linux Client Repository <[email protected]>
W: Some index files failed to download. They have been ignored, or old ones used instead.
有沒有辦法糾正這個問題,或者我應該等待 Microsoft/Canonical 產生/更新必要的金鑰簽名?
答案1
密鑰現已更新,您可以使用以下命令安裝它:
curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
答案2
簽署金鑰的有效期限已過期,幾天後微軟才產生了新金鑰。系統中的密鑰更換不是自動的,您需要刪除舊密鑰並新增密鑰。
有兩種方法可以解決該問題:一種是使用傳統apt-key add
命令,另一種是手動將新密鑰新增至密鑰環。
# 解決方案在 Ubuntu 21.04 之前有效(包括它)
您可以刪除不再有效的金鑰:
sudo apt-key del 1F3045A5DF7587C3
然後重新新增的有效金鑰:
curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
運行sudo apt update && sudo apt upgrade
你應該不會看到任何錯誤。
# 在 Ubuntu 21.04 及未來版本中有效的解決方案
當您嘗試在 Ubuntu 中使用新增 APT 儲存庫金鑰時apt-key
,您可能會看到以下訊息:
警告:apt-key 已棄用。改為管理 trust.gpg.d 中的金鑰環檔案(請參閱 apt-key(8))。
apt-key 手冊頁提到:
不建議使用 apt-key,除非在維護者腳本中使用 apt-key del 從主金鑰環中刪除現有金鑰。
因此,如果您使用 21.04 之前的 Ubuntu 版本,則可以使用apt-key del
和apt-key add
,但對於以下版本,您必須在密鑰環中手動添加密鑰(在Ubuntu 21.04 中,兩種解決方案都可以完美工作:我測試了它們)。
您可以刪除不再有效的金鑰:
sudo apt-key del 1F3045A5DF7587C3
下載密鑰並將其新增至密鑰環:
curl https://repo.skype.com/data/SKYPE-GPG-KEY | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/skype-stable-archive-keyring.gpg
開啟skype-stable.list
檔案...
sudo nano /etc/apt/sources.list.d/skype-stable.list
……並以此方式修改第一行:
deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/skype-stable-archive-keyring.gpg] https://repo.skype.com/deb stable main
運行sudo apt update && sudo apt upgrade
你應該不會看到任何錯誤。