Errors when updating package list with apt-get on (K)ubuntu

6,149

You will need to import the correct GPG keys for each repository. So, for each missing key, run this command:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com KEY

In your case, you are missing the keys for A040830F7FAC5991, 40976EAF437D05B5 and 16126D3A3E5C1192, you can get all three by running:

for key in A040830F7FAC5991 40976EAF437D05B5 16126D3A3E5C1192; do 
 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $key; done

After running this command, try sudo apt-get update again and it should work perfectly well.


Update, I was assuming that reimporting the keys would fix them, it looks like that did not work. Try this instead (source):

sudo apt-get clean
sudo mv /var/lib/apt/lists /var/lib/apt/lists.old 
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
Share:
6,149
Sekhemty
Author by

Sekhemty

_

Updated on September 18, 2022

Comments

  • Sekhemty
    Sekhemty over 1 year

    I get some errors when trying to update the package list with sudo apt-get update command, specifically the error messages are as follows:

    W: GPG error: http://dl.google.com stable Release: The following signatures were invalid: BADSIG A040830F7FAC5991 Google, Inc. Linux Package Signing Key 
    W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.canonical.com precise Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key 
    
    W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key 
    
    W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/Release  
    
    W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release  
    
    W: Some index files failed to download. They have been ignored, or old ones used instead.

    I'm using Kubuntu 12.04.

    EDIT
    I performed the commands suggested by terdon in his answer, but it still doesn't work; when trying to update the keys, I got the following output:

    Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.OE3Vb6NDgl --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com A040830F7FAC5991
    gpg: requesting key 7FAC5991 from hkp server keyserver.ubuntu.com
    gpg: key 7FAC5991: "Google, Inc. Linux Package Signing Key " not changed
    gpg: Total number processed: 1
    gpg:              unchanged: 1
    Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.QFmVRIYHrE --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
    gpg: requesting key 437D05B5 from hkp server keyserver.ubuntu.com
    gpg: key 437D05B5: "Ubuntu Archive Automatic Signing Key " not changed
    gpg: Total number processed: 1
    gpg:              unchanged: 1
    Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.kJGIgNoOEW --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
    gpg: requesting key 3E5C1192 from hkp server keyserver.ubuntu.com
    gpg: key 3E5C1192: "Ubuntu Extras Archive Automatic Signing Key " not changed
    gpg: Total number processed: 1
    gpg:              unchanged: 1
    

    And trying to use sudo apt-get update still gives me the same errors as before.

    • Beefy_Swain
      Beefy_Swain about 11 years
      I hate to be that guy, but you have tried restarting, and trying a different network right?
    • Sekhemty
      Sekhemty about 11 years
      Yes. I managed to solve it with the latest terdon's advice, thank you anyway ;)
  • Sekhemty
    Sekhemty about 11 years
    It didn't work. I edited my question by adding what I obtained.
  • Sekhemty
    Sekhemty about 11 years
    I've also tried to delete the not-working keys before updating, this time they are correctly imported (at least I think so) but for each one of these, I get the message gpg: no ultimately trusted keys found and keep getting the errors of my original question. Do you have some more suggestions?
  • terdon
    terdon about 11 years
    @Sekhemty see updated answer.
  • Sekhemty
    Sekhemty about 11 years
    This time it worked, I went trough the update process without any errors. I suppose that it is safe to delete the lists.old directory now, right?
  • terdon
    terdon about 11 years
    Yes, that is just a backup just in case, you should not need it if the command worked.