Install error. apt-get update. error during signature verification

Running the steps to install mongo community on WSL Ubuntu 20.04 . The “sudo apt-get update” step fails with error “signature could not be verified because public key is not available”.
I did run “sudo apt-key adv --keyserver”, but I am not sure which keyserver to use on that command.
What to do? I did the same install steps on a different system yesterday and it worked.

lae0901@DESKTOP-CHT933T:~$ sudo apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:4 https://cli.github.com/packages stable InRelease [3917 B]
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
Err:4 https://cli.github.com/packages stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
Hit:6 https://deb.nodesource.com/node_16.x focal InRelease
Get:7 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Hit:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release
Fetched 222 kB in 2s (119 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Failed to fetch https://cli.github.com/packages/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Some index files failed to download. They have been ignored, or old ones used instead.

You need to download the key directly, the instruction pipe it directly to apt-key:

Import the public key used by the package management system

I am running the steps to install MongoDB community edition.
Still getting the public key not available error.

lae0901@DESKTOP-CHT933T:~$ sudo apt-get install gnupg
Reading package lists... Done
Building dependency tree
Reading state information... Done
gnupg is already the newest version (2.2.19-3ubuntu2.2).
The following package was automatically installed and is no longer required:
  libc-ares2
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
ae0901@DESKTOP-CHT933T:~$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
OK
lae0901@DESKTOP-CHT933T:~$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse
lae0901@DESKTOP-CHT933T:~$ sudo apt-get update
Get:1 https://cli.github.com/packages stable InRelease [3917 B]
Err:1 https://cli.github.com/packages stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
Hit:2 https://deb.nodesource.com/node_16.x focal InRelease
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Hit:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Failed to fetch https://cli.github.com/packages/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Some index files failed to download. They have been ignored, or old ones used instead.

Unrelated to MongoDB, I should have picked that up in the first post.

Something github related, check that one.

1 Like

thank you. Got the answer here:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.