Every now and then in ubuntu, you might get this error while updating package with apt:
$ sudo apt update ... Err:6 https://apt.kitware.com/ubuntu bionic InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 291F9FF6FD385783
This might be several causes of this issue. The GPG signature server could have been temporarily down so you can re-force it simply by running:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 291F9FF6FD385783
Using the same key that is normally causing you trouble (in this instance 291F9FF6FD385783)
However recently I noticed that in some environment behind a strict proxy rules, and for example also under WSL in Windows, the access to the keyserver.ubuntu.com is actually blocked and cannot be reached.
This, for example, will give you the following error:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 291 F9FF6FD385783 Executing: /tmp/apt-key-gpghome.nR1O15nnkM/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 291F9FF6FD385783 gpg: keyserver receive failed: Server indicated a failure
I just discovered that you can use the port 80 for this. So, it is enough to just for something like:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 291F9FF6FD385783 Executing: /tmp/apt-key-gpghome.prdsQcWrls/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 291F9FF6FD385783 gpg: key A8E5EF3A02600268: public key "Kitware Apt Archive Automatic Signing Key (2020) <firstname.lastname@example.org>" imported gpg: Total number processed: 1 gpg: imported: 1 Reading package lists... Done Building dependency tree Reading state information... Done
And puff the trick is done.
P.S. ... yes use this kitware ppa to have always the latest cmake version available in ubuntu. I highly recommend it.