我有几个 Google Clouds 计算实例(美国、德国、澳大利亚)
在做的时候
apt-get update
今天我得到:
> Get:10 http://packages.cloud.google.com/apt
> google-cloud-packages-archive-keyring-stretch InRelease [3,876 B]
> 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:7 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
所有这些都是。我需要做什么吗,或者这是 Google 软件包损坏了吗?
谢谢
伊夫
答案1
如果您遵循此处的指南:https://cloud.google.com/sdk/docs/install#deb并使用该signed-by
选项,那么您需要向 apt-key 提供该--keyring
选项:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
答案2
在这里发现问题: https://cloud.google.com/compute/docs/troubleshooting/known-issues#keyexpired
因此您只需要在 apt-get update 之前运行这个命令:
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
答案3
现代 Debian 10 使用替代方案来注册包签名密钥,以下 Ansible 脚本对其进行了演示:
- name: Add GCP Apt signing keys.
ansible.builtin.apt_key:
id: "{{ item }}"
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
keyring: /usr/share/keyrings/gcp-deb-keys.gpg
loop:
# Rapture Automatic Signing Key, expires: 2023-03-02
- "7F92E05B31093BEF5A3C2D38FEEA9169307EA071"
# gLinux Rapture Automatic Signing Key, expires: 2022-12-04
- "59FE0256827269DC81578F928B57C5C2836F4BEB"
- name: Add GCP repo for Cloud SDK.
apt_repository:
filename: "gcp-google-cloud-sdk"
repo: "deb [signed-by=/usr/share/keyrings/gcp-deb-keys.gpg] https://packages.cloud.google.com/apt cloud-sdk-buster main"
state: present
# Contains: google-compute-engine-oslogin, google-osconfig-agent
- name: Add GCP repo for Compute Engine setup.
apt_repository:
filename: "gcp-compute-engine"
repo: "deb [signed-by=/usr/share/keyrings/gcp-deb-keys.gpg] https://packages.cloud.google.com/apt google-compute-engine-buster-stable main"
state: present
答案4
在 Ubuntu 22.04.2 上唯一对我有用的命令是从这个 GitHub 评论改编而来的:https://github.com/kubernetes/release/issues/1982#issuecomment-1415573798
# Use of gpg dearmor and dd required to get the key in the expected format
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg |
gpg --dearmor | sudo dd status=none of=/usr/share/keyrings/cloud.google.gpg
# Reference the keyring as documented if not done already
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" |
sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
# Now update should run successfully
sudo apt-get update