0

The following simple command is failing

$  gpg --search-keys "hi"
gpg: error searching keyserver: Server indicated a failure
gpg: keyserver search failed: Server indicated a failure

Probably hi is not associated to a key, but still... shouldn't I get a does not exist error?

Therefore I think I'm misusing gpg command.

Oh, my version is gpg (GnuPG) 2.2.27.

2 Answers 2

1

For me, the "old" GnuPG (currently v1.4.23) works as expected:

$ /usr/bin/gpg --search-keys "hi"
gpg: searching for "hi" from hkp server pool.sks-keyservers.net
gpg: key "hi" not found on keyserver

I can reproduce your issue with gpg2 (2.2.27):

$ /usr/bin/gpg2 --search-keys "hi"
gpg: error searching keyserver: Server indicated a failure
gpg: keyserver search failed: Server indicated a failure

I can remediate the issue by explicitly declaring the keyserver to use:

$ /usr/bin/gpg2 --keyserver pool.sks-keyservers.net --search-keys "hi"
gpg: data source: http://[2a03:4000:8:5c9:a86d:e5ff:fea9:7bc4]:11371
gpg: key "hi" not found on keyserver
gpg: keyserver search failed: Not found

It seems like gpg2 does not like the old keyserver option. From man gpg2:

--keyserver name This option is deprecated - please use the --keyserver in ‘dirmngr.conf’ instead.

I'm not an expert on dirmngr and details about its conf file don't seem to be covered anywhere. I speculate it may be sufficient to add keyserver <preferred-keyserver> to ~/.gnupg/dirmngr.conf to permanently fix the gpg2 behaviour if you don't want to give the --keyserver option every time.

1
  • For some reason, when I use your command /usr/bin/gpg2 --keyserver pool.sks-keyservers.net --search-keys "hi" I still get the same error as with gpg --search-keys "hi".
    – Enlico
    Feb 4, 2021 at 20:09
1

On my system, dirmngr from GnuPG uses DNS resolution through Tor by default. For me, the following configurations of dirmngr works:

~/.gnupg/dirmngr.conf

standard-resolver
no-use-tor
nameserver 8.8.8.8

Then, kill the process. It will be restarted automatically:

$ pkill dirmngr

Please be aware that this confguration could be less secure rather than the default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .