23

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

Error404
  • 8,278
  • 3
  • 35
  • 60

4 Answers4

21

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
10

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
    
Error404
  • 8,278
  • 3
  • 35
  • 60
7

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 instructions 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)
0

I was able to solve this issue without additional warnings following the set up instructions for (in my case) ubuntu jammy release (run with sudo privileges):

https://apt.kitware.com/

    test -f /usr/share/doc/kitware-archive-keyring/copyright || 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 \
    && echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null \
    && apt-get update