Skip to content

resolvconf not detected on some systems, resolv.conf overwritten by DHCP #13435

@Hurgotron

Description

@Hurgotron

What is the issue?

Symptom: MagicDNS stops working after a while

Reason: Even though resolvconf is installed and functional, it is not detected and "direct" mode is used. In case of use of dhcp, this leads to resolv.conf being overwritten eventually by dhcp via resolvconf, breaking MagicDNS.

In detail, the reason is that the resolv.conf contains the lines

# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.

and function resolvOwner in direct.go just checks for the existence of the string "systemd-resolved". After that, resolvedIsActuallyResolver in manager_linux.go checks if 127.0.0.53 is really configured as nameserver and if not, "direct" mode is used.

Workaround: delete the above two lines from /etc/resolvconf/resolv.conf.d/head (and restart networking).

Possible fix: Instead of just checking for the string "systemd-resolved", check for 127.0.0.53 being set as nameserver right away, and only if not, branch to the resolvconf checks.

Steps to reproduce

  1. Install Devuan (systemd-less Debian)
  2. Install tailscale
  3. on start, tailscale outputs
dns: resolvedIsActuallyResolver error: resolv.conf doesn't point to systemd-resolved; points to [<redacted>]
dns: [rc=resolved resolved=not-in-use ret=direct]
dns: using "direct" mode

which means, resolv.conf is being handled directly by tailscale

  1. wait dhcp lease time -> resolv.conf gets overwritten by dhcp via resolvconf.
  2. tailscale DNS is nonfunctional

Are there any recent changes that introduced the issue?

none

OS

Linux

OS version

Devuan daedalus (Debian 12.0)

Tailscale version

1.72.1

Other software

n/a

Bug report

BUG-18acaaf7e8e29198a0ebfb1e36d01b6bf47c14fdca33aa941bb67cb85cc063dd-20240910231224Z-8c21d93ffd589207

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions