Repository navigation
Open
Labels
Description
Submission type
- Bug report
systemd version 234 (234-2ubuntu10 on ubuntu 17.10)
ubuntu 17.10
domains within search domains should resolve successfully but instead they fail to resolve with error "resolve call failed: No appropriate name servers or networks for name found"
Setup resolv.conf as:
nameserver 127.0.0.53
search facebook.com
then attempt to lookup www.facebook.com (or facebook.com):
$ systemd-resolve facebook.com
facebook.com: resolve call failed: No appropriate name servers or networks for name found
$ systemd-resolve www.facebook.com
www.facebook.com: resolve call failed: No appropriate name servers or networks for name found
$ host www.facebook.com
Host www.facebook.com not found: 2(SERVFAIL)
debug log:
Oct 03 12:49:01 dogen systemd-resolved[32040]: Got message type=method_call sender=:1.562 destination=org.freedesktop.resolve1 object=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=ResolveHostname cookie=2 reply_cookie=0 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Looking up RR for www.facebook.com IN A.
Oct 03 12:49:01 dogen systemd-resolved[32040]: Looking up RR for www.facebook.com IN AAAA.
Oct 03 12:49:01 dogen systemd-resolved[32040]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=AddMatch cookie=48 reply_cookie=0 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.509 object=n/a interface=n/a member=n/a cookie=39 reply_cookie=48 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetNameOwner cookie=49 reply_cookie=0 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.509 object=n/a interface=n/a member=n/a cookie=40 reply_cookie=49 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Cache miss for www.facebook.com IN A
Oct 03 12:49:01 dogen systemd-resolved[32040]: Transaction 60262 for <www.facebook.com IN A> scope dns on */*.
Oct 03 12:49:01 dogen systemd-resolved[32040]: Transaction 60262 for <www.facebook.com IN A> on scope dns on */* now complete with <no-servers> from none (unsigned).
Oct 03 12:49:01 dogen systemd-resolved[32040]: Freeing transaction 60262.
Oct 03 12:49:01 dogen systemd-resolved[32040]: Sent message type=error sender=n/a destination=:1.562 object=n/a interface=n/a member=n/a cookie=50 reply_cookie=2 error=No appropriate name servers or networks for name found
Oct 03 12:49:01 dogen systemd-resolved[32040]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RemoveMatch cookie=51 reply_cookie=0 error=n/a
Oct 03 12:49:01 dogen systemd-resolved[32040]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.509 object=n/a interface=n/a member=n/a cookie=41 reply_cookie=51 error=n/a
Reacted by georgeto, Kuba, Sam Toyer, antihax, Devid, hxer7963 and John Starich
Activity
poettering commentedon Oct 4, 2017
so, do you have any name servers configured as well as a network connection that works? What does "systemd-resolve --status" say?
if you don't have DNS servers configured or no network connection set up, this is the error you get, and it has nothing to do with domain search lists..
johnl commentedon Oct 4, 2017
I do have name servers configured (network manager gets them from dhcp). all other domains not listed as search domains work fine, even new lookups that haven't been cached. And I've tried flushing the systemd-resolved cache and fully restarting it too.
poettering commentedon Oct 5, 2017
so my educated guess is that because the /etc/resolv.conf you supplied is not the one resolved itself wrote out resolved reads it in, and consideres it authoritative and as configuration source. However, it drops the 127.0.0.53 entry from it, since it knows that it is itself which is listening on that. Hence you basically told resolved about a search list, but at the same time you configured it to use an empty DNS server list.
i figure this is ultimately all because of the shortcoming that is explained in #7009, right?
I figure we should fix #7009 so that writing such manual resolv.conf snippets is not necessary, and we should make sure that handle things better if they are encountered.
johnl commentedon Oct 5, 2017
But I can lookup other records on all other domains fine when the search list is configured.
here is a log of me looking up facebook.com, which is in the search list, and then looking up github.com, which isn't in the search list. They're the first two lookups after a restart of systemd-resolved, so no cache. facebook.com lookup fails but github.com succeeds (I'm on a different network right now but same behaviour):
as to why I'm using
/etc/resolv.confat all - it just seems to be the Ubuntu 17.10 arrangement. I configured my search domains in the gui of network-manager and when it connects to the network it adds my search domains in there for me (along with the linenameserver 127.0.0.53yes)/etc/resolv.confis symlinked to/run/resolvconf/resolv.conf.Zenexer commentedon Nov 9, 2017
Workaround: leave resolv.conf as the default (generated by systemd); on my system it's linked to
/run/systemd/resolve/resolv.conf. Then, add your search domains to/etc/systemd/resolved.confin the formDomains=example.com another.example.com.Zenexer commentedon Nov 9, 2017
Note that even with the workaround, dig won't work as expected, as systemd only appends the search suffixes to unqualified domains. If asked to query
example, dig will instead queryexample., which won't have a suffix appended. This behavior differs from the old system, I believe, and will break some applications.poettering commentedon Dec 8, 2017
See my comment at #7544 (comment)
danielfett commentedon Dec 9, 2017
(I filed #7544 originally, continuing the discussion here!)
@poettering you said "This doesn't make available what @webhamster is trying to do, ..."
The thing is, I did not configure anything about this manually (all DHCP, no special settings in network-manager as far as I can tell). The real problem here seems to be that that somebody (network-manager?) is removing the DNS server entries, but not the search list entries. For example, currently the content of resolv.conf is:
Note that except for the first entry, none of these entries should still be in the list, since the only network I'm currently connected to is the "fritz.box" network, not the T-Mobile network and not the uni-stuttgart network (I was connected to them yesterday, but did not reboot in the mean time).
The current systemd-resolved status is:
thotypous commentedon Dec 11, 2017
I was struggling with the same behaviour @webhamster reported. It took me some time to realize
searchwas causing it. Before realizing it, I always needed to reboot after coming home from my university, otherwise I was not able to resolve names under the university's domain. Restarting systemd-resolve does not fix the issue. The workaround is to manually remove thesearchline from the auto-generated/etc/resolv.conffile (which still contains the university domain even though I am now at home -- it is automatically cleared only after a reboot).poettering commentedon Dec 13, 2017
This smells like a bug in Debian's/Ubuntu's resolvconf, or the hookup with it, and not with resolved really. Note that if your resolv.conf is managed by resolved, then it will contain a longer commented header explaining that. Since you don't have that it's something else that writes your resolv.conf, and the bug must be in that.
6 remaining items
codeaholics commentedon Jan 23, 2018
Certainly uninstalling
resolvconfimproved my situation, but I think there's still a bug insystemd-resolvdhere. Why, when I have my home domain in the search list inresolv.conf, cansystemd-resolvdnot resolve either an unqualified name in that domain, or a FQDN using that domain?JanKanis commentedon Jan 29, 2018
I also ran into (what appears to be) this problem. Removing the
resolvconfpackage fixed it.Gargravarr2112 commentedon Jan 30, 2018
Hmm, I'm trying the alpha version of Ubuntu 18.04 from a fresh install and running into this same issue, but
resolvconfis not installed. Editing/etc/resolv.confmanually restored DNS, but a reboot removes the customisation and the problem recurs.Output of
systemd-resolve --status:systemd --version: 235Kernel version: 4.13.0-25-generic x64
AJRepo commentedon Feb 4, 2018
The core issue seems to be with the fact that resolvconf does not clear out old domains in the "search" line in /etc/resolv.conf when given a new one by a DHCP server when moving between DHCP networks.
I can reliably replicate this problem with the following process:
search example1.comsearch example1.com example2.comIf you repeat steps 3,4,5 with new DHCP networks then you get in /etc/resolv.conf
search example1.com example2.com example3.com example4.com .....As a workaround you can delete the domains in /etc/resolv.conf that shouldn't be there.
Otherwise, when connected to exampleN.com's network you get the SERVFAIL for example1.com, example2,com ... exampleN-1.com. Essentially all the other domains that are in the
searchline in /etc/resolv.confZenexer commentedon Feb 9, 2018
@AJRepo I'm encountering SERVFAIL issues without bad
searchlines. The only solution I have found so far is to manually set something other than 127.0.0.1 as the nameserver in resolv.conf. This happens on all distros, on all networks, on a wide range of devices. Enterprise networks, home networks, coffee shop networks. Ubuntu, Arch, and anything else I happened to use recently (probably quite a few). It happens out-of-the-box, with no configuration on my part other than connecting to either a wireless or wired Ethernet networks.codeaholics commentedon Feb 9, 2018
@AJRepo I disagree with your analysis. Which is to say your analysis is correct, but incomplete! Yes, there's a problem with
resolvconfwhich goes away if that package is removed.However, this is the scenario I observe:
resolvconfmistakenly leavesmyhome.netin the search pathnslookup mynasandnslookup mynas.myhome.netboth fail.Yes,
myhome.netshouldn't be left in the search path. Yes, that's a bug inresolvconf(most likely). But given that it's there, why can'tsystemd-resolvdcorrectly resolve names in that domain? The DNS entries are in the public DNS, BTW, not hidden in a private DNS server only accessible on my VPN.runderwo commentedon Feb 9, 2018
@codeaholics Yes, this is exactly my experience and I had exactly the same question when I found that removing the left-behind search paths solved the problem. Why shouldn't these FQDN be resolved correctly just because part of the name is in the search path (whether by design or by accident)?
johnl commentedon Feb 9, 2018
I don't know why this is being linked to resolvconf so much, perhaps I don't understand how it works properly.
If I just make /etc/resolv.conf a normal file, edit it with vim and add a search domain for facebook.com, looking up www.facebook.com is then broken as I originally described. If I remove the search domain from resolv.conf it starts working again.
resolvconf doesn't seem in play here.
codeaholics commentedon Feb 9, 2018
@johnl absolutely! There is a
resolvconfissue, and it exacerbates this issue, but they are otherwise unrelated.AJRepo commentedon Feb 9, 2018
@Zenexer Did you mean 127.0.0.53, not 127.0.0.1? I believe that 127.0.0.53 is the systemd-resolved stub resolver.
@codeaholics & @runderwo What resolv.conf determines is a FQDN can depend on the network to which you connect. There are networks where machine names might look like "
foo.k12.bar.us" where if you type baz.bar.us it isn't yet a FQDN. Documentation for resolv.conf states that this is affected by thendotsparameter but on my system that's not set so should fall back to the default of 1. In other tests I think this is not an ndots issue (see below).@johnl The reason this is being linked to resolvconf is that if resolvconf is enabled then the file /etc/resolv.conf is being generated by resolvconf with the odd search line. In fact if someone has resolvconf enabled, it warns you this the file /etc/resolv.conf will be overwritten.
Further investigation:
Doing a tcpdump of TCP/UDP traffic I see what's happening is that the 2nd and additional domains specified in the search line do not get sent out via the interfaces connected to the internet. You can force this with the
-iflag.systemd-resolve -i eth0 www.example2.comworks but
systemd-resolve www.example2.comdoes not. So it seems that the additional domains on the search line interfere with which interface is used by systemd-resolve for DNS lookups.
Zenexer commentedon Feb 11, 2018
@AJRepo You're right, it's 127.0.0.53. I just instinctively wrote 127.0.0.1.
Oddly, I just checked, and on two of my Ubuntu 17.10 installations, it's now working, even with a bogus search domain that doesn't resolve on one of them. I could swear I implemented some hack to work around it, but whatever it was, it's gone, and both of those devices are working. Even queries that rely on the search domain are working, and they were definitely broken a few weeks ago. I haven't made any configuration changes in the interim. I'll check some other distros later tonight.
cetex commentedon Apr 12, 2018
Something someone developing systemd-resolved needs to answer is: Why is systemd-resolved not resolving something which is in search domain?
If i have "search consul" in /etc/resolv.conf systemd-resolved can't resolve anything with *.consul, i only get SERVFAIL back.
If i remove search domain (Which is a correct domain in our network), systemd-resolved can resolve *.consul again. Resolving *.consul should work in either case.
If i revert back to dnsmasq things works as expected, *.consul can be resolved with or without search domains specified.
The fact that resolvconf is doing something weird by not removing old search domains is entirely unrelated, systemd-resolved breaks for some reason when search domains is specified.
earonesty commentedon Jul 30, 2018
It seems, do me, that the "search" is being used to mean "authoritative" in the 127.0.0.53 underlying resolver, which in turn seems to be a bug in the idea of using a single dns server as "one resolver"
DNS servers, of course, don't do "search", and cannot be used in place of a resolver.
Removing the "search" fixes resolution, but the better fix, for me, was simply to remove the systemd resolvconf, and manually create a resolv.conf file.
juresaht2 commentedon Nov 25, 2021
For those who are having this issue with the resolution of non-local domains which end with
.local. systemd-resolvd will attempt to find an interface with a matching domain on it if it's.localand if it fails, the defaultnsswitch.confconfig will not fall-back to dns as it should, but will stick with the systemd-resolvd error (No appropriate name servers or networks for name found).Obviously you shouldn't be using
.localdomains for anything but mDNS, however if for whatever legacy reasons you are, the solution is to usehosts: files resolve dnsin/etc/nsswitch.confinstead of the default line. Then change your resolv.conf from stub to uplink by removing the link at/etc/resolv.confand replacing it so:ln -s /run/systemd/resolv.conf /etc/resolv.conf. Thensystemctl restart systemd-resolvedand it should work.MrEcco commentedon May 5, 2026
Thanks for #6976 (comment), but here's a shorter explanation:
*.localcan be resolved only to IP networks of your local interfaces.