5

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?

3

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!

3

This is because GPG parses keyring paths containing colons as URLs (yeah, I don't know about that either).

Try the following:

mv /etc/apt/trusted.gpg.d/home:hawkeye116477:waterfox.asc /etc/apt/trusted.gpg.d/home_hawkeye116477_waterfox.asc
0

What you're actually doing is adding the signing key of that repo (in this case Sublime's) to the list of authorized signing keys on your system. These are stored in /etc/apt/trusted.gpg.d/ - feel free to check them out.

I suggest looking for a file called '/tmp/apt-key-gpghome.Mi0IvTayBR/home:hawkeye116477:waterfox.asc.gpg' - I guess it's either an empty file, or an invalid key. I would also look for any leftover directories/folders named /tmp/apt-key-* in case there are more. Removing these temp files and directories should help.

It seems your issue is unrelated to what you're trying to do currently (add the Sublime repo key), caused by leftovers from previous unsuccessful apt-key runs.

1
  • There are NO /tmp/apt-key-* files so should I go ahead and delete the /etc/apt/trusted.gpg.d/home:hawkeye116477:waterfox.asc or other *.asc conflicting files each time I try to add a new repo key? – Shah-G Jun 19 '20 at 8:59
0

In Ubuntu 20.10, I fixed this issue pretty easily by doing such:

$ sudo -s
$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg >> /etc/apt/trusted.gpg.d/home:hawkeye116477:waterfox.asc.gpg

# exit from root
$ exit

$ sudo apt update

use the .asc file shown in the error while adding it via apt-key. In your case it was home:hawkeye116477:waterfox.asc.gpg defined in

gpg: invalid key resource URL '/tmp/apt-key-gpghome.Mi0IvTayBR/home:hawkeye116477:waterfox.asc.gpg'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.