Linux

[Tips] apt updateでGPGエラーが出たので解消しよう

Tips

 

apt updateでエラーが出ました。確認して解消しましょう。

実際に出たエラーで確認していきましょう。

# apt update
Hit:1 https://packages.microsoft.com/repos/azure-cli bionic InRelease
Hit:2 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:4 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:6 http://dl.google.com/linux/chrome/deb stable InRelease
Err:7 https://wsl-translinux.arkane-systems.net/apt  InRelease
  Could not resolve 'wsl-translinux.arkane-systems.net'
Get:8 http://packages.cloud.google.com/apt cloud-sdk-bionic InRelease [6786 B]
Err:8 http://packages.cloud.google.com/apt cloud-sdk-bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
Get:10 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:9 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9383 B]
Err:9 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
Fetched 323 kB in 3s (106 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
235 packages can be upgraded. Run 'apt list --upgradable' to see them.
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-bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
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 kubernetes-xenial 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-bionic/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 https://apt.kubernetes.io/dists/kubernetes-xenial/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 https://wsl-translinux.arkane-systems.net/apt/InRelease  Could not resolve 'wsl-translinux.arkane-systems.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

下の方にエラーがまとまって出ていることが分かります。

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-bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
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 kubernetes-xenial 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-bionic/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 https://apt.kubernetes.io/dists/kubernetes-xenial/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 https://wsl-translinux.arkane-systems.net/apt/InRelease  Could not resolve 'wsl-translinux.arkane-systems.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

まず、GPG errorが2つ出ていることが分かります。
http://packages.cloud.google.com/aptのキーですね

gcloud - Running `apt update` raises: "GPG error: cloud-sdk is not signed" - Stack Overflow
gcloud - Running `apt update` raises: "GPG error: cloud-sdk is not signed" - Stack Overflow

While running sudo apt update the following Warning, followed by an Error raises: W: GPG error: http ...

stackoverflow.com

キーを追加していきます。

# curl -O https://packages.cloud.google.com/apt/doc/apt-key.gpg && apt-key add apt-key.gpg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2537  100  2537    0     0  35732      0 --:--:-- --:--:-- --:--:-- 35732
OK

キーの問題は解消されました。

# apt update
Get:1 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:2 https://packages.microsoft.com/repos/azure-cli bionic InRelease
Hit:3 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Get:4 http://packages.cloud.google.com/apt cloud-sdk-bionic InRelease [6786 B]
Err:5 https://wsl-translinux.arkane-systems.net/apt  InRelease
  Could not resolve 'wsl-translinux.arkane-systems.net'
Get:6 http://packages.cloud.google.com/apt cloud-sdk-bionic/main amd64 Packages [319 kB]
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:9 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:10 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:11 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Get:8 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [9383 B]
Get:12 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [57.6 kB]
Hit:13 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 450 kB in 2s (256 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
236 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch https://wsl-translinux.arkane-systems.net/apt/InRelease  Could not resolve 'wsl-translinux.arkane-systems.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

なにかIPを参照できないURLにアクセスしようとしています。

/etc/apt/sources.list.d/を確認したところ上記のURLを含んだものがありこれを削除します。書き換えられる場合は書き換えでしょうか。

# apt update
Get:1 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Hit:2 http://packages.cloud.google.com/apt cloud-sdk-bionic InRelease
Hit:3 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:5 https://packages.microsoft.com/repos/azure-cli bionic InRelease
Hit:6 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Hit:7 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Hit:8 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:9 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:10 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Fetched 64.4 kB in 1s (44.7 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
236 packages can be upgraded. Run 'apt list --upgradable' to see them.

ここまでくれば後はUpgradeするだけです。

 

-Linux
-