Ubuntu Repository – How to Fix Add Repo App-Key Fails

gpgrepositoryUbuntu

On Ubuntu 20.04 LTS, I'm trying to install packages like MongoDB, Sublime Text 3 etc. but before adding them their repo url must be added.
I'm trying this command:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

and it's failing with this message:

gpg: invalid key resource URL '/tmp/apt-key-gpghome.Mi0IvTayBR/home:hawkeye116477:waterfox.asc.gpg'
gpg: keyblock resource '(null)': General error
gpg: key 7721F63BD38B4796: 2 signatures not checked due to missing keys
gpg: key 5E62D791625A271E: 1 signature not checked due to a missing key
gpg: key 3B4FE6ACC0B21F32: 3 signatures not checked due to missing keys
gpg: key D94AA3F0EFE21092: 3 signatures not checked due to missing keys
gpg: key 871920D1991BC93C: 1 signature not checked due to a missing key
gpg: Total number processed: 12
gpg:       skipped new keys: 12

Fix?

Best Answer

Just ran into a very simalar problem and by deleting the problem key in /etc/apt/trusted.gpg.d/{Problem-Key}.asc I was able to solve the issue!

Hope this helps!