dnspython icon indicating copy to clipboard operation
dnspython copied to clipboard

macOS Tahoe does not provide dns configuration in /etc/resolv.conf

Open dwt opened this issue 3 weeks ago • 4 comments

Describe the bug On macOS Tahoe /etc/resolv.conf is not populated with dns server information anymore:

> cat /etc/resolv.conf
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
#   scutil --dns
#
# SEE ALSO
#   dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
❯ scutil --dns
DNS configuration

resolver #1
  search domain[0] : fritz.box
  nameserver[0] : 192.168.10.1
  nameserver[1] : fde2:c0d2:6cb1:0:62b5:8dff:fecc:bddf
  nameserver[2] : 2a02:8109:b59e:7800:62b5:8dff:fecc:bddf
  if_index : 14 (en0)
  flags    : Request A records, Request AAAA records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

resolver #2
  domain   : local
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300000

resolver #3
  domain   : 254.169.in-addr.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300200

resolver #4
  domain   : 8.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300400

resolver #5
  domain   : 9.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300600

resolver #6
  domain   : a.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 300800

resolver #7
  domain   : b.e.f.ip6.arpa
  options  : mdns
  timeout  : 5
  flags    : Request A records, Request AAAA records
  reach    : 0x00000000 (Not Reachable)
  order    : 301000

resolver #8
  domain   : localhost
  nameserver[0] : 127.0.0.1
  port     : 53
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

DNS configuration (for scoped queries)

resolver #1
  search domain[0] : fritz.box
  nameserver[0] : 192.168.10.1
  nameserver[1] : fde2:c0d2:6cb1:0:62b5:8dff:fecc:bddf
  nameserver[2] : 2a02:8109:b59e:7800:62b5:8dff:fecc:bddf
  if_index : 14 (en0)
  flags    : Scoped, Request A records, Request AAAA records
  reach    : 0x00020002 (Reachable,Directly Reachable Address)

This means, that dnspython is not able to resolve name servers anymore.

⏎                                                                            ❯ python -c '
  import dns.resolver
  r = dns.resolver.Resolver()
  print("Nameservers:", r.nameservers)
  '
Traceback (most recent call last):
  File "<string>", line 3, in <module>
    r = dns.resolver.Resolver()
  File "/Users/dwt/Code/Projekte/sntl/provisioning/.venv/lib/python3.13/site-packages/dns/resolver.py", line 953, in __init__
    self.read_resolv_conf(filename)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/dwt/Code/Projekte/sntl/provisioning/.venv/lib/python3.13/site-packages/dns/resolver.py", line 1047, in read_resolv_conf
    raise NoResolverConfiguration("no nameservers")
dns.resolver.NoResolverConfiguration: no nameservers

Context (please complete the following information):

  • dnspython version [e.g. 2.2.1]
  • Python version [e.g. 3.10.0]
❯ uv pip list | grep dnspython
Using Python 3.13.4 environment at: /Users/dwt/Code/Projekte/sntl/provisioning/.venv
dnspython          2.8.0
  • OS: [e.g. macOS Monterey]
❯ sw_vers
ProductName:		macOS
ProductVersion:		26.1
BuildVersion:		25B78

Considered Workarounds

Probably I will manually add dns config to /etc/resolv.conf but macOS will regenerate that file periodically, at least with system updates, so this is not a good setup. Furthermore, this means that every user will have to manually update that file when they reconfigure their system or roam between different networks with different name servers.

dwt avatar Dec 09 '25 11:12 dwt

It's populated for me. I get the same comment you do about it not being used by macOS, but then it has a nameserver entry and a search list, as received from my DHCP server.

rthalley avatar Dec 09 '25 20:12 rthalley

That is really weird.

Do you have any manually configured nameservers?

dwt avatar Dec 10 '25 03:12 dwt

It auto-generates if I set a local nameserver, and it also auto-regenerates if I clear it (in that case it falls back to what DHCP says)

rthalley avatar Dec 10 '25 16:12 rthalley

I see generation on other Tahoe machines, so my sense is that the file, while not used by macOS itself, is still meant to be generated and populated for legacy software. So I'm wondering rather why it isn't generating for you!

rthalley avatar Dec 10 '25 16:12 rthalley

That is really, weird, I will Look into the further

dwt avatar Dec 13 '25 07:12 dwt

Indeed, this seems to have been fixed on my system after some time has passed. Not quite sure why. Sorry for the bother.

dwt avatar Dec 13 '25 13:12 dwt