10

I am using WSL (windows-for-linux) with installed Ubuntu 20.04.3 LTS. When I run sudo apt-get update I get following error:

Err:7 https://apt.kitware.com/ubuntu bionic InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4
Fetched 11.0 kB in 1s (7552 B/s)

I tried the tips posted in: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY but that does not work for me - gpg complains about "no data":

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
Executing: /tmp/apt-key-gpghome.Cz3vHTxU7i/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
gpg: keyserver receive failed: No data

What shall I do to make apt-get update work?

UPDATE:

As requested I share /etc/apt/source.list

deb http://archive.ubuntu.com/ubuntu/ focal main restricted
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse


deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
deb https://apt.kitware.com/ubuntu/ bionic main
3
  • If you're on 20.04 or focal, why does your paste show bionic or 18.04 ?
    – guiverc
    Jan 28, 2022 at 11:49
  • Just follow the instructions: apt.kitware.com Jan 28, 2022 at 12:59
  • "If you're on 20.04 or focal, why does your paste show bionic or 18.04" I am suspecting big part of my problem is related to WSL (windows for linux) but I have no idea what to do to fix my issues. Jan 31, 2022 at 8:57

3 Answers 3

9

I added the key to the Ubuntu keyserver (for some reason, they didn't have the key for the Kitware apt repository, which was updated in 2022)

Running this should solve your problem now:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
2
  • that worked! thanks! Feb 16, 2022 at 13:21
  • Received the following warning with this approach: > Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    – schester
    Jan 26 at 23:03
3

Just follow the official documentation:

  1. Initially, run the following command to install all the prerequisites:

    sudo apt-get update
    sudo apt-get install gpg wget
    
  2. Now add the GPG keyring:

    wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
    
  3. Update:

    sudo apt-get update
    
6
  • that sequence did not work for me. W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: apt.kitware.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4 W: Failed to fetch apt.kitware.com/ubuntu/dists/bionic/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4 Jan 31, 2022 at 8:54
  • Run apt update and try again! Jan 31, 2022 at 8:55
  • it still does not work. Jan 31, 2022 at 8:56
  • Remove the repository and try again. Jan 31, 2022 at 8:56
  • Edit your question to add the output of cat /etc/apt/sources.list Jan 31, 2022 at 8:57
3

In your /etc/apt/sources.list.d/kitware.list it's:

deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main

So this repository is forced to validate with /usr/share/keyrings/kitware-archive-keyring.gpg this public key.

But you have updated your public key with apt-key global keystore (which is in /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/), not that specific file.

So there are two ways to make it work:

  • follow the exact instruction of "Obtain a copy of our signing key" section in https://apt.kitware.com/ to create /usr/share/keyrings/kitware-archive-keyring.gpg this file.
  • Remove [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] inside /etc/apt/sources.list.d/kitware.list so that apt can read the corresponding public key from global keystore. (You still need to install the public key from somewhere)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.