报错:NO_PUBKEY

2022年11月5日 | 分类: 【技术】

apt update 时报错:

Hit:1 https://dl.yarnpkg.com/debian stable InRelease
Hit:2 https://dl.google.com/linux/chrome/deb stable InRelease
Err:1 https://dl.yarnpkg.com/debian stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
Hit:3 http://mirrors.cloud.aliyuncs.com/ubuntu jammy InRelease
Ign:4 http://archive.ubuntu.com/ubuntu trusty InRelease
Hit:5 http://mirrors.cloud.aliyuncs.com/ubuntu jammy-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu trusty Release
Hit:8 http://mirrors.cloud.aliyuncs.com/ubuntu jammy-backports InRelease
Hit:9 http://mirrors.cloud.aliyuncs.com/ubuntu jammy-security InRelease
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
W: http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
W: Some index files failed to download. They have been ignored, or old ones used instead.

原因是之前使用 apt-key 添加 key 的方式已经过时,需要将 key 放到 /etc/apt/trusted.gpg.d/ 中。

apt-key list
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 23E7166788B63E1E
gpg --export --armor 23E7166788B63E1E | sudo apt-key add -

然鹅输出:

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

咋么办?

手册:https://manpages.debian.org/stretch/apt/apt-key.8.en.html

参考:https://blog.csdn.net/ayunnuo/article/details/119138489
参考:https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey
参考:https://askubuntu.com/questions/1306111/why-yarn-key-update-failes-all-the-time-gpg-error-https-dl-yarnpkg-com-debia
参考:https://bbs.deepin.org/post/240763

参考:https://www.dropboxforum.com/t5/Apps-and-Installations/Debian-Linux-Key-is-stored-in-legacy-trusted-gpg-keyring/td-p/580399
参考:https://askubuntu.com/questions/1407632/key-is-stored-in-legacy-trusted-gpg-keyring-etc-apt-trusted-gpg