Repository navigation
Description
systemd version the issue has been seen with
v240 (+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
Used distribution
Arch Linux (x86_64)
Expected behaviour you didn't see
systemd-resolved shall resolve local non-FQDN hosts (by adding the DNS search domain for the corresponding link when querying upstream servers).
Unexpected behaviour you saw
systemd-resolved fails to resolve non-fqdn hosts, without even sending out an upstream query:
$ resolvectl query myhost1
myhost1: resolve call failed: All attempts to contact name servers or networks failed
Lack of upstream query verified via tcpdump (with empty cache). It just blocks for one second and then prints the error above.
Manually adding the search domain works fine, so does resolving any other FQDN host:
$ resolvectl query myhost1.mydomain.lan
myhost1.mydomain.lan: 10.0.1.42 -- link: net0
-- Information acquired via protocol DNS in 2.3ms.
-- Data is authenticated: no
$ resolvectl query example.com
example.com: 93.184.216.34 -- link: net0
-- Information acquired via protocol DNS in 11.2ms.
-- Data is authenticated: no
Steps to reproduce the problem
Setup systemd-networkd for DHCP and enable DNS search domain usage as described in man(5) systemd.network:
# /etc/systemd/network/lan.network
[Match]
Name=net0
[Network]
DHCP=ipv4
[DHCP]
UseDomains=yes
Setup systemd-resolved with defaults, symlink /run/systemd/resolve/stub-resolve.conf to /etc/resolv.conf, enabling stub resolver mode.
Verify search domain has been received from DHCP:
$ resolvectl domain
Global:
Link 3 (net0): mydomain.lan
Link 2 (net1):
Query non-FQDN host:
$ resolvectl query myhost1
myhost1: resolve call failed: All attempts to contact name servers or networks failed
Query FQDN host:
$ resolvectl query myhost1.mydomain.lan
myhost1.mydomain.lan: 10.0.1.42 -- link: net0
-- Information acquired via protocol DNS in 2.3ms.
-- Data is authenticated: no
Activity
lynix commentedon Jan 11, 2019
Forgot to mention that I do have the issue when using "regular" applications as well (e.g.
ping,ssh, etc.), so it cannot just beresolvectlacting likedig(suppressing search domain usage itself).And here's my NSS configuration:
/etc/nsswitch.conf:
Removing the
[!UNAVAIL=return]makes regular applications work again, as the names can be resolved via traditional nss-dns, but there is still a delay of ~1s from theresolvehook.And why should you rely on
libnss_dnsif you havelibnss_resolve?lynix commentedon Jan 11, 2019
I'd consider #11325 not to be an exact duplicate as adding the record type does not work in my case:
aaronp24 commentedon Jan 11, 2019
Adding the record type doesn't work for me either, so maybe my comment at #11325 (comment) should have been here instead.
The problem is commit 1750854, which made link-local name resolution authoritative for both *.local and single-label lookups. It probably should have only done that for .local.
smcv commentedon Jan 14, 2019
I can reproduce this on Debian
unstable. Workaround:resolved: allow LLMNR & DNS to both resolve short names
poettering commentedon Jan 18, 2019
I prepped a fix in #11485. Would be excellent, if people could test this?
resolved: make sure single-label lookups are bound preferable to unic…
aaronp24 commentedon Jan 18, 2019
I confirmed that this fixes it.
lynix commentedon Jan 21, 2019
+1, works for me as well, thanks!
resolved: preferably route single-label lookups to unicast DNS scopes…
lynix commentedon May 2, 2019
Well, I'm having the same issues again with systemd-242.19:
andreyv commentedon May 2, 2019
Confirmed on Arch Linux, and the
LLMNR=noworkaround doesn't seem to work this time.aaronp24 commentedon May 2, 2019
I confirmed this and tracked the regression down to commit 5e2a51d. This commit causes
systemd-networkdto fail to populate thesystemd-resolvedsearch domains. You can tell by doingresolvectl domainand noticing that no search domains are listed.aaronp24 commentedon May 2, 2019
I dug into this and figured out the problem with this commit. In my configuration, there are no added search domains so
link->network->search_domainsis empty. This causesordered_set_printto skip writing theDOMAINS=prefix. Then, code a few lines later writes the domainname which it expects to be on the same line asDOMAINS=, but it's not. So /run/systemd/netif/links/2 ends up containing this:instead of this
As a result,
systemd-resolvedis not able to parse the search domains from this file and continues on without them.aaronp24 commentedon May 2, 2019
@keszybz should we file a new issue for this?
networkd: Fix code to write DOMAINS and ROUTE_DOMAINS in /run/systemd…
ValdikSS commentedon Dec 19, 2020
systemd 246 (v246.7-2.fc33)is unable to resolve global non-fqdn hosts. For example,ai..aihas A and MX record, but it fails to resolve with bothresolvectl queryanddig:arvidjaar commentedon Dec 20, 2020
@ValdikSS
I see it too. Please open new issue for it, commenting in closed issue is not going to be of much help.