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.