sdfgwert.jpg

  最近在编译Armbian时候遇到“the following signatures couldn’t be verified because the public key is not available”

lbl@orangepi4:~$ sudo apt-get update
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/debian stretch InRelease     
Get:2 https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates InRelease [91.0 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/debian stretch-backports InRelease [91.8 kB]
Err:2 https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY 04EE7237B7D453EC
Err:3 https://mirrors.tuna.tsinghua.edu.cn/debian stretch-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY 04EE7237B7D453EC
Get:5 https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates InRelease [94.3 kB]
Err:5 https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY AA8E81B4331F7F50
Get:6 https://mirrors.tuna.tsinghua.edu.cn/debian stretch Release [118 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/debian stretch Release.gpg [2,410 B]
Ign:7 https://mirrors.tuna.tsinghua.edu.cn/debian stretch Release.gpg   
Hit:4 https://apt.armbian.com bionic InRelease                          
Reading package lists... Done
W: GPG error: https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY 04EE7237B7D453EC
E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.tuna.tsinghua.edu.cn/debian stretch-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY 04EE7237B7D453EC
E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/debian stretch-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY AA8E81B4331F7F50
E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates InRelease' is not signed.
lbl@orangepi4:~$

原因:

这个问题在使用apt-get update就会出现,Ubuntu 环境下,也会出现这个情况,出现这个问题的原因是:apt打包系统具有一组受信任的密钥,这些密钥确定软件包是否可以通过身份验证并因此受信任以安装在系统上。但是有时候系统并没有所需的所有密钥,因此会遇到此问题。

如果不解决这个问题,那么在使用sudo apt-get upgrade时就会遇到错误而无法更新。

lbl@orangepi4:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
...
E: Some packages could not be authenticated
lbl@orangepi4:~$

解决办法:

只需要将出现NO_PUBLIC添加进到系统即可,将最后出现的一串KEY 通过以下命令添加到系统中。如我上面最后出现的一串NO_PUBKEY 7638D0442B90D010 NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY EF0F382A1A7B6500
这里共有3个,所以要添加三次,使用下面命令

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EF0F382A1A7B6500

每个密钥只需要添加一次就可以,添加成功标志:

lbl@orangepi4:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
Executing: /tmp/apt-key-gpghome.pDTXaMVLxm/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
gpg: key 7638D0442B90D010: 14 signatures not checked due to missing keys
gpg: key 7638D0442B90D010: public key "Debian Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

至此,密钥已经添加成功,试试

sudo apt-get update
sudo apt-get upgrade
最后修改:2020 年 05 月 16 日
您的支持就是我持续更新的动力!