One-line fix for "The following signatures couldn't be verified because the public key is not available"?

Solution 1:

I'm glad you asked, astute Ubuntu user. Why yes there is a solution that will make you very happy. And here it is:

sudo apt-get update 2>&1 |
sed -ne 's?^.*NO_PUBKEY ??p' |
xargs -r -- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys

Boom, that's it. No wasted time searching web sites, mucking with the shell, etc.