I frequently cross this issue, and always have to google for an answer. Does anyone have a permanent fix for BADSIG errors from apt-get?

W: GPG error: http://download.virtualbox.org lucid Release: The following signatures were invalid: BADSIG 54422A4B98AB5139 Oracle Corporation (VirtualBox archive signing key)

link|improve this question

62% accept rate
Are you using apt-cacher-ng? – lfaraone Aug 10 '10 at 21:17
It is important that you understand what are GPG signatures on APT used for, the GPG signature validates that the repository contains packages provided from a trusted source. It ensures both integrity and authenticity. Every time you add a new repository from some provider you will need to add it's GPG key. – João Pinto Aug 10 '10 at 22:03
follow the example in the link - replace the example code in the linked answer with the BADSIG codes in your question. – fossfreedom Oct 7 '11 at 17:13
fossfreedom, I couldn't get that solution to work on my system. Kept getting "--keyserver" was not understood. The solution offered by Dr.Ubuntu below worked for me. – Dirk Oct 27 '11 at 16:57
Have a look also here askubuntu.com/questions/67594/… I think the commands you are using are correct, your just not using the correct key. – Bruno Pereira Dec 9 '11 at 14:29
show 2 more comments
feedback

5 Answers

up vote 9 down vote accepted

The important part of your error message is the following in bold:

W: GPG error: http://download.virtualbox.org lucid Release: The following signatures were invalid: BADSIG 54422A4B98AB5139 Oracle Corporation (VirtualBox archive signing key)

Copy the stuff in bold and then open a terminal and type:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 54422A4B98AB5139

i.e. paste using SHIFT + INS the number you have copied - 54422A4B98AB5139

You'll have to enter your password, the key will be downloaded and integrated.

link|improve this answer
my error was related to a bad repo, not just the key missing ... however your answer is likely valid for 99% of the cases – Casey Aug 19 '10 at 1:56
+1 because that's quite a useful thing to know how to do. However, it did not fix my problem. – Kazark Dec 29 '11 at 20:13
3  
Has this actually worked for anyone? – Jacob Johan Edwards Mar 15 at 4:43
BADSIG is different than NO_PUBKEY. For BADSIG the answer below solved it. I'm not sure how I ended up in this situation, but I had BADSIG on 5 different PPAs even after importing the keys. – mfisch May 21 at 4:02
feedback

Here's the (easiest) solution:

Type the following commands in the Terminal:

$ sudo -i

# apt-get clean

# cd /var/lib/apt

# mv lists lists.old

# mkdir -p lists/partial

# apt-get clean

# apt-get update

Credits: ubuntugeek.com

Edit:

If the error occurs again (maybe after a few days/months), open nautilus as root > navigate to var/lib/apt > delete the "lists.old" folder > then open the "lists" folder and delete the "partial" folder. Now, execute the aforementioned commands again.

link|improve this answer
1  
This solves the more common error for me--updating through an Internet connection with a proxy (WiFi "cafe" that requires web logon) which corrupts some of my lists if I get logged off or forget to log on during an update. – hobs Jan 1 at 23:03
1  
What would the actual error be if qbi's answer doesn't help but this does? – ArtOfCode Feb 1 at 7:02
feedback

Try deleting the key

sudo apt-key del 16126D3A3E5C1192

then updating the repository

sudo apt-get update

You should get a NO_PUBKEY error instead of a BADSIG error and

sudo apt-key finger

should not find the key (called "Ubuntu Extras Archive Automatic Signing Key")

Now add the key

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192

The result of apt-key finger should have

pub   1024D/3E5C1192 2010-09-20
      Key fingerprint = C474 15DF F48C 0964 5B78  6094 1612 6D3A 3E5C 1192
uid                  Ubuntu Extras Archive Automatic Signing Key <ftpmaster@ubuntu.com>

If that does not work, try

apt-get clean            # Remove cached packages
cd /var/lib/apt
mv lists lists.old       # Backup mirror info
mkdir -p lists/partial   # Recreate directory structure
apt-get clean
apt-get update           # Fetch mirror info

Source: this ubuntu forums thread

link|improve this answer
feedback

If you still have this error after adding the key try:

  1. goto your apt-cacher-ng cache directory, and delete the virtualbox entry:

    cd /var/cache/apt-cacher-ng
    sudo rm -rf download.virtualbox.org
    
link|improve this answer
feedback

Found another server that we could use

gpg --keyserver hkp://subkeys.pgp.net --recv-keys [YOURKEYINQUESTION]

gpg --armor --export [YOURKEYINQUESTION] | apt-key add -

Hope it helps

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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