60

While running sudo apt update the following Warning, followed by an Error raises:

W: 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 B53DC80D13EDEF05
E: The repository 'http://packages.cloud.google.com/apt cloud-sdk InRelease' is not signed.

Does anybody know how can I solve it?

Livne Rosenblum
  • 196
  • 1
  • 12
dwightjl
  • 1,984
  • 2
  • 13
  • 13

1 Answers1

117

This is a known issue.

https://cloud.google.com/compute/docs/troubleshooting/known-issues#keyexpired

Run the following command to obtain the latest key:

wget https://packages.cloud.google.com/apt/doc/apt-key.gpg \
    && apt-key add apt-key.gpg

or

curl -O https://packages.cloud.google.com/apt/doc/apt-key.gpg \
    && apt-key add apt-key.gpg

or.. if you like it simple without extraneous files and are feeling adventurous:

curl -f https://packages.cloud.google.com/apt/doc/apt-key.gpg \
    | sudo apt-key add -
Jay Taylor
  • 13,185
  • 11
  • 60
  • 85
dwightjl
  • 1,984
  • 2
  • 13
  • 13
  • 37
    Or if you are not root `curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -` – tobltobs Apr 12 '18 at 10:06
  • 7
    I have the same issue in Ubuntu18 and this didn't solve the issue, its still saying `W: 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 6A030B21BA07F4FB E: The repository 'https://packages.cloud.google.com/apt cloud-sdk InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.` any idea whats happening here?? – cross_handle Mar 22 '20 at 20:44
  • In case the above fails with `gpg: no valid OpenPGP data found`: https://stackoverflow.com/questions/21338721/gpg-no-valid-openpgp-data-found – Ohad Schneider Apr 08 '20 at 16:10
  • 4
    Doing this has no effect on the error message. – Throw Away Account Apr 01 '21 at 18:57
  • 3
    `wget https://packages.cloud.google.com/apt/doc/apt-key.gpg && apt-key add apt-key.gpg` Something may be changed, which makes `curl` not working. – Yan QiDong Apr 12 '21 at 01:36
  • wget no longer doesn't work. Neither does curl. – Zendel Jul 11 '21 at 14:44
  • 44
    The [installation instructions](https://cloud.google.com/sdk/docs/install#deb) include `curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -`. That extra `--keyring` argument seemed to do the trick. – falsePockets Jul 18 '21 at 10:27
  • Or if this is happening in a Docker image build (thanks to @falsePockets for the above comment): `RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -` – Dawngerpony Jan 16 '23 at 11:50
  • You can always `curl -S https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg -v -` and verify the key is diff/valid, and then run it again with `| sudo apt-key add -` or `| sudo apt-key --keyring /etc/apt/trusted.gpg.d/cloud.google.gpg add -`. You can always use the output of `sudo apt-key list` to then `sudo apt-key export KEYID | sudo gpg --dearmour -o /usr/share/keyrings/cloud.google--exp-xx-xx-xxxx.gpg`. In any event, **make sure to update** `/etc/apt/sources.list.d/google-cloud-sdk.list` with whichever path you chose. `kubernetes.list` can use the same key too, as an FYI!. – Rik Jan 23 '23 at 15:47
  • Now responds: `gpg: no valid OpenPGP data found.` – chrishmorris Aug 02 '23 at 06:44