わすれっぽいきみえ

みらいのじぶんにやさしくしてやる

packages.cloud.google.com/aptの公開鍵が古いと怒られたときは鍵を更新しましょう

久しぶりにWSL / Ubuntuでパッケージをアップデートしようとしたら

$ sudo apt update
(略)
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 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
W: Failed to fetch http://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 FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
W: Some index files failed to download. They have been ignored, or old ones used instead.

公開鍵が古いと怒られたので公式ページの公開鍵保存のコマンドを読み直した。

cloud.google.com

$ 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
Get:1 http://packages.cloud.google.com/apt cloud-sdk InRelease [6739 B]
Get:2 http://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages [171 kB]
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 178 kB in 2s (112 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

できた。これで心置きなく sudo apt upgrade が実行できる。

関連記事は以下:

kimikimi714.com