1. 错误提示
在Ubuntu中,执行apt-get update时,报错!
root@c86b:/# apt-get update && apt-get install vim
Get:1 http://repo.mysql.com/apt/debian buster InRelease [22.1 kB]
Err:1 http://repo.mysql.com/apt/debian buster InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
Get:2 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Get:3 http://deb.debian.org/debian buster InRelease [122 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [433 kB]
Get:5 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 Packages [7909 kB]
Get:7 http://deb.debian.org/debian buster-updates/main amd64 Packages [8788 B]
Reading package lists... Done
W: GPG error: http://repo.mysql.com/apt/debian buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
E: The repository 'http://repo.mysql.com/apt/debian buster 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.
备注:主要看到了 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY
。
2. 解决办法
(1)重新生成该ID的公钥
# 在root权限下,或者在普通用户中使用 sudo 操作
gpg --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
(2)将公钥添加到本机的密钥中
gpg --export --armor 467B942D3A79BD29 | sudo apt-key add -
(3)执行apt-get update,成功!