无效的签名来自repo.skype.com:我该如何清除这个?

今天我执行了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 <se-um@microsoft.com>
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 <se-um@microsoft.com>
W: Failed to fetch https://repo.skype.com/deb/dists/stable/InRelease  The following signatures were invalid: EXPKEYSIG 1F3045A5DF7587C3 Skype Linux Client Repository <se-um@microsoft.com>
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

我真希望微软的某个人能够站出来修复这个bug,或者是一个支持Ubuntu软件包分发工具的志愿者... 这个问题一直存在,并且影响着所有使用Skype的人。 - Scott Stensland
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-key添加APT存储库密钥时,可能会看到以下消息:

警告:apt-key已被弃用。请改为在trusted.gpg.d中管理密钥文件(参见apt-key(8))。

apt-key的手册页提到:

除了在维护脚本中使用apt-key del从主密钥环中删除现有密钥之外,apt-key的使用已被弃用。

因此,如果你使用的是Ubuntu 21.04之前的版本,可以使用apt-key delapt-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,您不应该看到任何错误。

我在不稳定的频道上,指示起作用,只是需要在列表文件中引用“unstable main”。我有一个用于稳定版和一个用于不稳定版的列表文件,它们都指向不稳定版。 - Csaba Toth