且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用apt-get时出现 “no public key available” 的解决方法

更新时间:2022-01-09 13:42:59

在 Debian 和 Ubuntu 下运行 apt-get update 刷新更新源的时候,经常遇到 “There is no public key available for the following key IDs” 的问题,具体表现为以下错误提示:

W:There is no public key available for the following key IDs: 3B4FE6ACC0B21F32,
W:There is no public key available for the following key IDs: 3B4FE6ACC0B21F32,

解决方法如下,

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

把 3B4FE6ACC0B21F32 替换为你出现问题的IDs。另外,如果有如下问题,是因为加入了 natty-backports 源,删掉即可:

W:Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/main/source/Sources 404 Not Found [IP: 91.189.91.13 80],
W:Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/restricted/source/Sources 404 Not Found [IP: 91.189.91.13 80],
W:Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/universe/source/Sources 404 Not Found [IP: 91.189.91.13 80],
W:Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/natty-backports/multiverse/source/Sources 404 Not Found [IP: 91.189.91.13 80],

运行如下命令:

sudo sed -i '/natty\-backports/d' /etc/apt/sources.list{,.d/*}

原文发布时间:2017-11-07
本文来自云栖社区合作伙伴“Debian社区”,了解相关信息可以关注“Debian社区”。