我的环境:
# uname -a
Linux app11 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
#
# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
#
尝试运行时apt-get update
,我收到一堆错误:
# apt-get update
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://security.debian.org stretch/updates InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch-backports InRelease
Hit:5 http://deb.debian.org/debian stretch Release
Get:6 http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease [6,377 B]
Ign:7 https://artifacts.elastic.co/packages/6.x/apt stable InRelease
Hit:8 https://artifacts.elastic.co/packages/6.x/apt stable Release
Get:9 http://packages.cloud.google.com/apt google-compute-engine-stretch-stable InRelease [3,843 B]
Get:10 http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch InRelease [3,876 B]
Hit:11 https://download.docker.com/linux/debian stretch InRelease
Err:6 http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
Err:9 http://packages.cloud.google.com/apt google-compute-engine-stretch-stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
Err:10 http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
Fetched 6,377 B in 0s (7,132 B/s)
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: http://packages.cloud.google.com/apt cloud-sdk-stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.cloud.google.com/apt google-compute-engine-stretch-stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: Failed to fetch http://packages.cloud.google.com/apt/dists/cloud-sdk-stretch/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: Failed to fetch http://packages.cloud.google.com/apt/dists/google-compute-engine-stretch-stable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: Failed to fetch http://packages.cloud.google.com/apt/dists/google-cloud-packages-archive-keyring-stretch/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6A030B21BA07F4FB
W: Some index files failed to download. They have been ignored, or old ones used instead.
#
请指教。
答案1
每安装 Google Cloud SDK | Cloud SDK 文档- Debian / Ubuntu:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
或者
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
遵从:
sudo apt-get update
答案2
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
答案3
接受的答案对我来说不起作用。
最后我注意到,为了安装 google sdk,我使用了以下内容,直接从 google 文档复制:
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
sudo apt-get update && sudo apt-get install google-cloud-sdk
最后我注意到/etc/apt/sources.list.d/google-cloud-sdk.list
有一个对 gpg 文件的引用,我认为这可能是有问题的“NO_PUBKEY 6A030B21BA07F4FB”不匹配:
deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
当我打开 gpg 文件 ( /usr/share/keyrings/cloud.google.gpg
) 时,它不存在。因此我进行了编辑google-cloud-sdk.list
以删除引用:
deb https://packages.cloud.google.com/apt cloud-sdk main
此后,我就可以apt-get update
顺利进行更新了。
稍微偏离主题 - 修复以前的 google sdk 安装
然后我想起使用 snap 安装了 google sdk 和 kubectl,因为我遇到了错误,我希望这个可以修复它。当安装程序找不到正确的存储库时,它建议使用 snap。
我原来的安装命令:
snap install google-cloud-sdk --classic
snap install google-cloud-sdk --classic
因此,我删除了 snap 版本并安装了常规版本。
snap remove google-cloud-sdk
snap remove kubectl
sudo apt-get install kubectl
sudo apt-get install google-cloud-sdk
答案4
我遇到了类似的错误:
Err:4 https://packages.cloud.google.com/apt cloud-sdk InRelease
The following signatures couldn't be verified because the public key is
not available: NO_PUBKEY B53DC80D13EDEF05
这些答案对我都不起作用。
我最终不得不从我的中删除谷歌云条目/etc/apt/sources.list.d/
:
sudo rm /etc/apt/sources.list.d/google-cloud-sdk.list*
这为我删除了以下条目:
google-cloud-sdk.list
google-cloud-sdk.list.distUpgrade
google-cloud-sdk.list.save
对于您的情况,您可能需要查找并删除/etc/apt/sources.list.d/
与之对应的条目cloud-sdk-stretch
。