Filesystem errors can be tricky © John Trainor, Flickr
Filesystem errors can be tricky © John Trainor, Flickr

I had a system crash with my Raspberry Pi during an update process. As a result the disk was corrupted and I needed to fix the trusted GPG keys as well as the cache for apt-get.

I got the following error after running apt-get update, so if you get:

W: GPG error: http://archive.raspberrypi.org jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 82B129927FA3303E

First, check your filesystem:

sudo touch /forcefsck
sudo reboot

Try update again, if it fails, update the keys:

sudo cp /etc/apt/trusted.gpg ~
sudo rm /etc/apt/trusted.gpg
sudo apt-key adv --keyserver http://archive.raspbian.org/raspbian.public.key --recv-keys 90FDDD2E
sudo apt-key adv --keyserver http://archive.raspbian.org/raspbian.public.key --recv-keys 7FA3303E
sudo apt-key adv --keyserver http://archive.raspbian.org/raspbian.public.key --recv-keys 78661FA5

Note that if you had other keys you had installed, you will have to reinstall them manually.

Restart the operation:

sudo apt-get clean
sudo apt-get update

If this does not solve your solution, replace the /etc/apt/trusted.gpg file with a fresh one.