Skip to content

systemd-resolved: First resolution after restart fails consistently #12142

Open

Description

@vihai

Context:

  • Ubuntu 18.10
  • systemd 239

Every time systemd-resolved is restarted the very first query fails like this:

root@lino:~# systemctl restart systemd-resolved.service 
root@lino:~# systemd-resolve lists.acao.it
lists.acao.it: resolve call failed: All attempts to contact name servers or networks failed
root@lino:~# systemd-resolve lists.acao.it
lists.acao.it: 45.66.80.19
               2a09:62c0:0:10::19

-- Information acquired via protocol DNS in 2.2ms.
-- Data is authenticated: no

Network-wise, a burst of requests for the same name (48, both for A and AAAA) are sent to the recursor and their relative (successful) reply is received in a very short time, afterwise the resolution fails.

21:57:28.162800 IP 192.168.0.32.56665 > 192.168.0.1.53: 36259+ [1au] A? lists.acao.it. (42)
21:57:28.162849 IP 192.168.0.32.57310 > 192.168.0.1.53: 18484+ [1au] AAAA? lists.acao.it. (42)
21:57:28.163878 IP 192.168.0.1.53 > 192.168.0.32.57310: 18484 1/0/0 AAAA 2a09:62c0:0:10::19 (59)
21:57:28.164019 IP 192.168.0.32.57310 > 192.168.0.1.53: 5278+ [1au] AAAA? lists.acao.it. (42)
21:57:28.164212 IP 192.168.0.1.53 > 192.168.0.32.56665: 36259 1/0/0 A 45.66.80.19 (47)
21:57:28.164280 IP 192.168.0.32.56665 > 192.168.0.1.53: 31171+ [1au] A? lists.acao.it. (42)
21:57:28.164540 IP 192.168.0.1.53 > 192.168.0.32.57310: 5278 1/0/0 AAAA 2a09:62c0:0:10::19 (59)
[...]

Full log here:
tcpdump.log

This is causing some inconvenience since the restart event is not so rare as it happens on every DHCP renew (as a client).

The same behaviour happens to programs invoking getaddrinfo(3), with the additional issue that it returns EAI_NONAME instead of a temporary failure.

Activity

  1. poettering commented on Apr 1, 2019

    @poettering
    Member

    Please turn on debug logging in systemd-resolved and then provide the log output generated on the first lookup. To turn on debug logging run systemctl edit systemd-resolved.service, and then type this:

    [Service]
    Environment=SYSTEMD_LOG_LEVEL=debug
    

    Then issue systemctl restart systemd-resolved.

  2. added
    needs-reporter-feedback ❓
    on Apr 1, 2019
  3. vihai commented on Apr 3, 2019

    @vihai
    Author

    You find the log attached here.
    It may be relevant to note that the remote resolver is a Mikrotik RouterOS DNS proxy whose implementation conformance may very well be... uhm... exotic...

    systemd-resolved.log

    Here is the log of a subsequent, successful, resolution:

    systemd-resolved2.log

    Finally a third, cached, resolution:

    systemd-resolved3.log

  4. removed
    needs-reporter-feedback ❓
    on Mar 23, 2021
  5. tolgaulas commented on Jun 2, 2021

    @tolgaulas

    I may bring a different point of view to the problem which I faced with digitalocean droplets (regardless but debian10 for me). On happy path resolvedctl status should show Current DNS Server: <my defined ip>; but after sometime the resolvedctl status was showing Current DNS Server: 67.207.67.3 (which is the digitalocean's dns server) which is set by their cloud-init setup. Restarting the systemd-resolved was bringing back the state to the happy path. I did not try the solution in this link (https://www.digitalocean.com/community/questions/how-to-avoid-that-my-etc-resolv-conf-get-overwriting), but may be help full to someone..

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