The following signatures were invalid: BADSIG 40976EAF437D05B5

I would get this error whenever I would run ‘sudo aptitude update’ or ‘sudo apt-get update’:

W: GPG error: http://mirror.anl.gov oneiric Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>

I was able to resolve this issue for this GPG public key in particular by doing the following:

sudo apt-get clean
sudo mv /var/lib/apt/lists /tmp
sudo mkdir /var/lib/apt/lists
sudo apt-get update