System: Linux Mint 19 Cinnamon, based on Ubuntu 18.04.

Upon my limited knowledge of gpg, which version I will state here for future references:

gpg (GnuPG) 2.2.4
libgcrypt 1.8.1

I thought the following command does not need anything special specified:

$ gpg --recv-keys 402543B2D98854007F627D36A63A58A3F2E17569

But I get the following error upon executing it:

gpg: keyserver receive failed: Address family not supported by protocol

Sometimes, it works as expected, so I am unsure how to proceed, I am unable to pinpoint the problem?

Note, that I only have IPv4, no IPv6, if that is relevant.


1 Answer 1



This error may happen when one is not connected to IPv6 network.


I have just installed GnuPG on my FreeBSD, and it kindly informed me, quoting:

GnuPG, when run on hosts without IPv6 connectivity, may fail to connect to dual-stack hkp servers.

Workaround on FreeBSD

Add this line:


to the file:


Applied to Linux Mint 19

  1. To make sure that new options are read and that after the installation of a new GnuPG version the installed dirmngr is running, you may want to kill an existing dirmngr first:
sudo gpgconf --kill dirmngr
  1. Applied to my Linux Mint 19, there is no default location of this config file.

Various places are read, I will only note that I have successfully created the file in:

  1. In addition to answering the question, let me note, that should you encounter any further errors, add this to the config file too:

     debug-level guru
     log-file ~/.gnupg/dirmngr.log

You must log in to answer this question.

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