Score:5

apt-get update fails due to NO_PUBKEY 6AF7F09730B3F0A4

in flag

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
Matt Welke avatar
in flag
I tried to fix your question by correcting the typo you made ("source.list" should be "sources.list") but I received an error from Stack Overflow: "Edits must be at least 6 characters; is there something else to improve in this post?". So I'm leaving this comment here in case someone runs into this issue.
guiverc avatar
cn flag
If you're on 20.04 or *focal*, why does your paste show *bionic* or 18.04 ?
Johan Palych avatar
us flag
Just follow the instructions: https://apt.kitware.com/
Ivan Angelov avatar
in flag
"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.
Score:5
ni flag

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
schester avatar
in flag
Received the following warning with this approach: > Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Ivan Angelov avatar
in flag
that worked! thanks!
Score:2
my flag

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
    
Ivan Angelov avatar
in flag
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: https://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 https://apt.kitware.com/ubuntu/dists/bionic/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4
Someone avatar
my flag
Run `apt update` and try again!
Ivan Angelov avatar
in flag
it still does not work.
Someone avatar
my flag
Remove the repository and try again.
Someone avatar
my flag
Edit your question to add the output of `cat /etc/apt/sources.list`
Someone avatar
my flag
The error is because you are using the Bionic repository in focal. @IvanAngelov Also, you should avoid using apt key as it's deprecated.
Score:1
tm flag

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)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.