Skip to content

resolve: domain names ending with .local not resolved #4881

Closed

Description

@ayekat

Submission type

  • Bug report
  • Request for enhancement (RFE)

systemd version the issue has been seen with

232-6

Used distribution

Arch Linux

Expected behaviour you didn't see

According to the comment in resolved-dns-scope.c:466, having the following entry in /etc/resolv.conf:

search somenet.local

should cause resolved to handle the domain somenet.local like any other domain (instead of treating it as mDNS). Yet it fails to do so:

$ systemd-resolve somehost.somenet.local
somehost.somenet.local: resolve call failed: No appropriate name servers or networks for name found
$ echo $?
1

whereas using drill or dig to query the DNS server to resolve a .local domain name works fine.

Steps to reproduce the problem

  1. Use /etc/nsswitch.conf as recommended in the nss-resolve (8) man page.
  2. Create a symbolic link /etc/resolv.conf to /run/systemd/resolve/resolv.conf.
  3. Make sure resolved is running and resolv.conf contains the nameserver and the .local network domain in the search list as advertised by the DHCP server (will require either UseDomains=yes in /etc/systemd/network/×××.network, or Domains=... in /etc/systemd/resolved.conf).
  4. Use drill or dig to successfully query the DNS server for a .local host in the network.
  5. Use systemd-resolve to attempt to resolve the same name (or any userspace application to attempt to connect to that host).

Changing the line in /etc/nsswitch.conf as follows resolves the problem temporarily, as glibc will continue to query the DNS server if resolved fails:

hosts: files mymachines resolve dns myhostname

But that is just a workaround (as would be disabling the stub DNS resolver of resolved).

Activity

  1. changed the title [-]Names in .local TLD not resolved [OR] Mismatch between nss-resolve manpage and actual status[/-] [+]resolve: Names in .local TLD not resolved [OR] Mismatch between nss-resolve manpage and actual status[/+] on Dec 13, 2016
  2. bits01 commented on Jan 8, 2017

    @bits01

    @ayekat using this form:
    hosts: files mymachines resolve dns myhostname

    Wouldn't failed resolutions happen twice? E.g. resolve cannot resolve a hostname, then it continues to dns which probably does the same thing as resolve just tried.

    I think the intention is for resolve to be a replacement for both dns and myhostname and only use the latter two if resolved is not installed/running.

  3. ayekat commented on Jan 8, 2017

    @ayekat
    ContributorAuthor

    In theory, yes. But in this case (domains ending with .local), resolve fails to resolve the hostname, whereas dns succeeds.

    However, reading your comment, I do see the intention behind [!UNAVAIL=return] now. Thank you, it does make more sense to me now. I therefore assume that the bug lies with resolved having trouble with the .local TLD. But I'd like to hear some feedback on that before jumping to false conclusions.

  4. piotr-dobrogost commented on Jan 9, 2017

    @piotr-dobrogost

    I naively expect above behavior (failing name resolution) to return the UNAVAIL status

    I think you should not expect this as according to man nsswitch.conf unavail means

    The service is permanently unavailable. This can
    mean either that the required file cannot be read,
    or, for network services, that the server is not
    available or does not allow queries. The default
    action for this condition is "continue".

    thus in case of a name service failing to resolve a name it should not return unavail as it was trying to perform name resolution.

    I have /etc/resolve.conf symlinked to /usr/lib/systemd/resolv.conf which contains only one entry nameserver 127.0.0.53 and systemd-resolved/nslookup both resolve local hosts in .local domain fine (however they stop resolving these hosts after some time which I raised as issue #5048. Is there anything preventing you from using this setup instead of symlinking /etc/resolv.conf to /run/systemd/resolv.conf?

    I think the intention is for resolve to be a replacement for both dns and myhostname and only use the latter two if resolved is not installed/running.

    This would be a logical consequence of systemd-resolved being more capable than traditional name resolution through resolv.conf. If this is the case then the resolution of this bug should be to state the rationale for using UNAVAIL and not NOTFOUND clearly in the docs.

  5. changed the title [-]resolve: Names in .local TLD not resolved [OR] Mismatch between nss-resolve manpage and actual status[/-] [+]resolve: domain names ending with `.local` not resolved[/+] on Jan 9, 2017
  6. ayekat commented on Jan 9, 2017

    @ayekat
    ContributorAuthor

    OK, now I'm a little puzzled. systemd-resolve is now able to correctly resolve names ending with .local again. Still same version as stated above. I am not sure how this (or above) has happened, but this all seems to be a non-issue.

    I'm sorry for all the noise. I'll investigate on how above might have happened; for the moment, I will close this issue.

    Thanks to everyone who responded anyway.

  7. piotr-dobrogost commented on Jan 9, 2017

    @piotr-dobrogost

    I am not sure how this (or above) has happened, but this all seems to be a non-issue.

    I suspect you might be observing the same problem which I raised in issue #5048. The next time .local names stop resolving (and I suspect they will stop) see if running systemd-resolve --flush-cashes resolves :) the issue (it does in my case). It seems using NOTFOUND status in place of UNAVAIL in nsswitch.conf is the perfect workaround for now :)

    It's a pity no maintainer answered here for a month since this issue was raised...

  8. piotr-dobrogost commented on Jan 10, 2017

    @piotr-dobrogost

    In issue #5051 there's exactly opposite problem raised; dig doesn't resolve .local names whereas systemd-resolve does resolve these names. Although in that case the name being resolved is single-label as opposed to multi-label like here.
    It would be useful to see output of systemd-resolve --status to get some insight as to why systemd-resolve does not resolve some name.

  9. JoelLinn commented on Dec 20, 2025

    @JoelLinn

    9 years and this issue still persists

    resolvectl flush-caches && resolvectl query privat.linn.local

    > journalctl -u systemd-resolved -f
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_call sender=:1.244 destination=org.freedesktop.resolve1 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=FlushCaches  cookie=2 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetConnectionUnixProcessID cookie=135 reply_cookie=0 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.94 path=n/a interface=n/a member=n/a  cookie=79 reply_cookie=135 signature=u error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: D-Bus cache flush request from client PID 34737 (resolvectl) with UID 0
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Flushed all caches.
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_return sender=n/a destination=:1.244 path=n/a interface=n/a member=n/a cookie=136 reply_cookie=2 signature=n/a error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_call sender=:1.245 destination=org.freedesktop.resolve1 path=/org/freedesktop/resolve1 interface=org.freedesktop.resolve1.Manager member=ResolveHostname  cookie=2 reply_cookie=0 signature=isit error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: idn2_lookup_u8: privat.linn.local → privat.linn.local
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetConnectionUnixProcessID cookie=137 reply_cookie=0 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.94 path=n/a interface=n/a member=n/a  cookie=80 reply_cookie=137 signature=u error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: D-Bus hostname resolution request from client PID 34738 (resolvectl) with UID 0
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Looking up RR for privat.linn.local IN A.
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Looking up RR for privat.linn.local IN AAAA.
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=AddMatch cookie=138 reply_cookie=0 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=GetNameOwner cookie=139 reply_cookie=0 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.94 path=n/a interface=n/a member=n/a  cookie=82 reply_cookie=139 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=error sender=n/a destination=:1.245 path=n/a interface=n/a member=n/a cookie=140 reply_cookie=2 signature=s error-name=org.freedesktop.resolve1.NoNameServers error-message=No appropriate name servers or networks for name found
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RemoveMatch cookie=141 reply_cookie=0 signature=s error-name=n/a error-message=n/a
    Dez 20 11:30:13 joel-ThinkPad-P15-Gen-1 systemd-resolved[5473]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.94 path=n/a interface=n/a member=n/a  cookie=81 reply_cookie=138 signature=n/a error-name=n/a error-message=n/a
    
    

    whereas nslookup works fine.

    I have other non .local domain zones configured on the same dns server and they resolve fine. Unless they are CNAME or DNAME records that point to something .local, then everything breaks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions