apt-get update遇到NO_PUBKEY

2020-08-06 10:45:54 浏览数 (1)

这是因为给 Ubuntu 安装软件的时候需要做验证,当然了,这个并不是必须的,也就是你的容器里也可以装没有经过认证可能不安全的源中安装需要的软件,虽然不建议,但是有时候为了快速调试,比如在公司内部的源里安装软件,可以试一下。

如果遇到 NO_PUBKEY 的问题,如下:

代码语言:javascript复制
root@spark-sparkoperator-58f598c98b-x7vjn:/etc/apt/trusted.gpg.d# apt-get update
Get:1 http://mirrors.tencent.com/ubuntu bionic InRelease [242 kB]
Err:1 http://mirrors.tencent.com/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
Reading package lists... Done
W: GPG error: http://mirrors.tencent.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.tencent.com/ubuntu bionic 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.
root@spark-sparkoperator-58f598c98b-x7vjn:/etc/apt/trusted.gpg.d# apt-get install iputils-ping
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package iputils-ping

上面是我发现镜像里没有 ping 工具,所以需要装一个,但是遇到了 NO_PUBKEY 的问题,于是通过下面的命令可以成功安装,原理当然就是,没有做验证了。

代码语言:javascript复制
apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true  install iputils-ping

搞清楚原理,其实这类问题是很容易解决的,类似的如 Centos,也是一个道理。

0 人点赞