
今天我做了sudo apt upgrade
,然後,作為雙重檢查,我做了sudo apt update
。後者終止於:
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease
Get:6 https://repo.skype.com/deb stable InRelease [4,502 B]
Err:6 https://repo.skype.com/deb stable InRelease
The following signatures were invalid: EXPKEYSIG 1F3045A5DF7587C3 Skype Linux Client Repository <[email protected]>
Fetched 4,502 B in 5s (894 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
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.
為了解決這個問題,我打電話sudo apt remove skypeforlinux
然後又做了另一個sudo apt update
。更新再次終止,並顯示有關無效簽章的訊息。
如何解決這個無效簽名問題?
$ uname -mrs
Linux 5.4.0-77-generic x86_64
$ lsb_release -d
Description: Ubuntu 20.04.2 LTS
答案1
簽署金鑰的有效期限已過期,幾天後微軟才產生了新金鑰。系統中的密鑰更換不是自動的,您需要刪除舊密鑰並新增密鑰。
有兩種方法可以解決該問題:一種是使用傳統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
你應該不會看到任何錯誤。