Raspbian – Key is stored in legacy trusted.gpg keyring

On a Raspberry Pi sometimes when you run apt update you will receive an error “Key is stored in legacy trusted.gpg keyring”.

You can fix this by running the below commands:

ln -s /usr/share/keyrings/raspbian-archive-keyring.gpg /etc/apt/trusted.gpg.d/raspbian-archive-keyring.gpg
rm /etc/apt/trusted.gpg
apt update

This will download the latest gpg key.