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

在Ubuntu和Debian下运行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/*}

via:https://www.vmvps.com/apt-get-error-no-public-key-available-solution.html

    所有主机信息仅是为及时分享并收录,不做推荐!
    专门搜集、分享国内高速、稳定的香港、日本、韩国、新加坡、美西CN2等优质线路的主机:FastVM