如何使用Apt解决过期密钥(EXPKEYSIG)

时间:2019-05-19 01:26:02  来源:igfitidea点击:

在使用apt包管理器更新apt缓存或包安装期间,我收到签名过期消息( EXPKEYSIG 7A318D3B5072A13F。这意味着gpg签名密钥已过期。

错误

以下是我的Debian 9系统的日志:

sudo apt update

Hit:1 http://security.debian.org stretch/updates InRelease
Get:2 http://repo.mysql.com/apt/debian stretch InRelease [19.2 kB]
Hit:3 https://deb.nodesource.com/node_10.x stretch InRelease
Err:2 http://repo.mysql.com/apt/debian stretch InRelease
  The following signatures were invalid:   **EXPKEYSIG 7A318D3B5072A13F**   MySQL Release Engineering <[email protected]>
Hit:4 https://packages.sury.org/php stretch InRelease
Ign:5 http://mirrors.digitalocean.com/debian stretch InRelease
Get:6 http://mirrors.digitalocean.com/debian stretch-updates InRelease [91.0 kB]
Hit:7 http://mirrors.digitalocean.com/debian stretch Release
Reading package lists... Done
...
...

使用以下命令列出系统上为apt配置的所有密钥。

sudo apt-key list

我们将看到这样的过期密钥。

解决方案:

现在,通过运行下面的命令更新过期的密钥。这里的7A318D3B5072A13F是我的系统上的密钥已过期。

sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 7A318D3B5072A13F

我们必须使用系统上过期的密钥更改7A318D3B5072A13F。