系统更新报错--NO_PUBKEY

错误信息

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository <devel@kali.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.

网友说是证书签名过期,要重新获取

deb http://http.kali.org/kali kali-rolling main non-free contrib

解决办法

wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add

添加其他源

deb http://http.kali.org/kali kali-rolling main non-free contrib
#ubuntu
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

因为有些安装包在只ubuntu的源里有,添加后方便安装

执行

sudo apt-get update

报错:

W: GPG error: http://mirrors.aliyun.com/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu xenial InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

原因和上面一样

解决

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

提示

gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/run/user/0/gnupg/d.yxdtz3qfxad3bakdigbecgmf/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

安装相关依赖:

apt-get install software-properties-common dirmngr

再次

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32

OK
执行

sudo apt-get update

OK

原文地址:https://www.cnblogs.com/lanqie/p/8513102.html