Usually when you have a non default DNS configuration in your system, for example if you're using dnsmasq
or another DNS service, other than systemd-resolve
, it's possible that dirmngr
used by gpg
fails to get the resolved name for keyserver.ubuntu.com, then, you need to check your name resolution software.
In my case, I have installed dnsmasq
for name resolution in a Zimbra mail server. In this case it is important that you prevent that the resolvconf
software controls dnsmasq
, this is editing the /etc/default/dnsmasq
file and uncommenting this line: IGNORE_RESOLVCONF=yes
. Then you have to restart the dnsmasq
and try to resolve with the local dns server with this command:
:~$ host -v keyserver.ubuntu.com 127.0.0.1
If it is ok, you will see something like this:
Trying "keyserver.ubuntu.com"
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13994
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;keyserver.ubuntu.com. IN A
;; ANSWER SECTION:
keyserver.ubuntu.com. 417 IN A 162.213.33.8
keyserver.ubuntu.com. 417 IN A 162.213.33.9
Received 70 bytes from 127.0.0.1#53 in 14 ms
Trying "keyserver.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33907
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;keyserver.ubuntu.com. IN AAAA
Received 38 bytes from 127.0.0.1#53 in 1 ms
Trying "keyserver.ubuntu.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45211
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;keyserver.ubuntu.com. IN MX
;; AUTHORITY SECTION:
ubuntu.com. 1748 IN SOA ns1.canonical.com. hostmaster.canonical.com. 2018053167 10800 3600 604800 3600
Received 99 bytes from 127.0.0.1#53 in 16 ms
Even if you're not using some DNS server, try to ask to systemd-resolve
if it can resolve the URL with this:
:~$ host -v keyserver.ubuntu.com 127.0.0.53
If not, let us know what you get.