ys memos
Blog

aptでgcloudのNO_PUBKEYを解消する


ubuntu

2023/01/15

はじめに

apt updateをしたところ、NO_PUBKEYのエラーが起こった。

エラー内容

apt updateの結果が以下(正常動作部は省略)。

$ sudo apt update
Err:10 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 XXXXXXXXXXXXXXXX
Fetched 217 kB in 2s (136 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: 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 XXXXXXXXXXXXXXXX
W: Failed to fetch https://packages.cloud.google.com/apt/dists/cloud-sdk/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXXXXXXX
W: Some index files failed to download. They have been ignored, or old ones used instead.

原因

ローカルの Google Cloud のパブリックキーが古くなっていることが原因と思われる。

解消方法

パブリックキーを再インポートするとよい。

公式インストール手順に記載されている該当コマンドを実行すると良い。

$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

解消の確認

$ sudo apt update
Hit:5 https://packages.cloud.google.com/apt cloud-sdk InRelease
Fetched 210 kB in 2s (95.4 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

おわりに

参考

関連タグを探す