macOS: container DNS fails under a full-tunnel VPN when the /etc/resolv.conf servers don't answer (relay never tries the Mac's other resolvers)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- macos, rust
- Domain
- backend, networking
Research direction
Start with daemon/dns.rs, especially mac_resolvers and relay_query, then review how #1097 selects resolvers and how #1067 handles supplemental domains. Reproduce with the full-tunnel VPN and an unresponsive /etc/resolv.conf resolver; the issue is done when relay lookups can use the Mac's working resolver and container and build DNS queries succeed.
Written by the indexing model from the issue text.
Description
Kiri version and system
0.3.0 on macOS 27.2.1 (Apple silicon), shared NAT on (default)
What you did
Two VPNs are connected at the same time:
- OpenVPN Connect, full tunnel (the default route is split into
0/1+128.0/1via autuninterface). - Tailscale (macOS standalone build) with MagicDNS on. While the full-tunnel VPN is up, the Tailscale node goes offline and
100.100.100.100stops answering.
macOS DNS state while both are connected:
$ grep nameserver /etc/resolv.conf
nameserver 100.100.100.100
nameserver fd7a:115c:a1e0::53
$ scutil --dns (trimmed)
resolver #1
nameserver[0] : 100.100.100.100
nameserver[1] : fd7a:115c:a1e0::53
if_index : (utun, Tailscale)
flags : Supplemental, Request A records, Request AAAA records
resolver #2
nameserver[0] : 8.8.8.8 # pushed by the full-tunnel VPN
nameserver[1] : 8.8.4.4
flags : Request A records
$ dig +time=2 +tries=1 @100.100.100.100 registry-1.docker.io # times out
$ dig +time=2 +tries=1 @8.8.8.8 registry-1.docker.io # answers
$ dscacheutil -q host -a name registry-1.docker.io # answers (macOS falls back)
Then:
docker run --rm alpine nslookup -type=a registry-1.docker.io
printf 'FROM alpine:3\nRUN echo ok\n' > Dockerfile
docker build .
What happened
$ docker run --rm alpine nslookup -type=a registry-1.docker.io
;; connection timed out; no servers could be reached
$ docker build .
#3 [internal] load metadata for docker.io/library/alpine:3
ERROR: failed to solve: alpine:3: failed to resolve source metadata for docker.io/library/alpine:3: docker.io/library/alpine:3: not found
buildkitd log:
fetch failed error="... dial tcp: lookup registry-1.docker.io on 172.17.0.1:53: server misbehaving"
kiri diag logs:
WARN daemon the VM's DNS at its gateway did not answer; container lookups go through the Mac
WARN daemon the VM's NAT network is unreachable, so published ports go over vsock (they still work); a VPN, or Kiri not allowed under Local Network in Privacy & Security, usually causes this
Also from a container: direct UDP DNS times out (nslookup google.com 8.8.8.8), while TCP egress works (wget http://1.1.1.1 gets a 301). docker pull works, since the daemon pulls on the Mac.
What you expected instead
Container and build lookups succeed whenever the Mac itself can resolve the name. On the same Mac with the same two VPNs connected, OrbStack resolved names in containers and builds fine before I switched to Kiri.
Disconnecting the full-tunnel VPN fixes it in Kiri: the gateway DNS works again, Tailscale comes back online, and 100.100.100.100 answers.
Anything else
Happens every time while both VPNs are connected. Workaround: disconnect the full-tunnel VPN before building.
The lookup fails in two places:
- The VM gateway resolver (
192.168.64.1) doesn't answer while the full-tunnel VPN is up, so the agent falls back to the vsock relay. - The relay (
daemon/dns.rs,mac_resolvers→relay_query) asks only the/etc/resolv.confservers. Here both are Tailscale's, and neither answers. The Mac's working resolver,8.8.8.8inscutil --dns, is never tried, so the relay returns SERVFAIL.
This is still the case on main after #1097: select_mac_resolvers falls back to scutil --dns's primary resolvers only when /etc/resolv.conf has no nameservers, not when they don't answer.
Possible fixes:
- When every
/etc/resolv.confserver fails, the relay could try the other non-scoped resolvers fromscutil --dns(here8.8.8.8) before returning SERVFAIL. - Or, as a last resort, it could answer A/AAAA through the macOS system resolver (
getaddrinfo/DNSServiceGetAddrInfo), as it already does for supplemental domains without a nameserver (#1067). The system resolver handles this fallback itself.
kiri vm set --shared-nat off probably doesn't help, since DNS goes through the same relay and the same resolv.conf servers.
Related: #1071 (TCP egress under a full-tunnel VPN, fixed in 0.3.0) and #1067 (split-DNS via scutil --dns).
- Dominant language
- Rust
- Stars
- 7.5k
- Forks
- 329
- Avg merge
- 8h 54m
- Merged PRs (30d)
- 426
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from libracoder/kiri
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
libracoder/kiri#1138 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
libracoder/kiri#1143 ·
Maintainers usually reply within 1 day
-
VM can go to sleep as idle during a long /containers/create (first run of a large image): "the VM stopped"Possibly taken @takealook97 claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
libracoder/kiri#1140 ·
Maintainers usually reply within 1 day
-
Windows: `kiri storage reclaim` does nothing and reports "Native Linux"Possibly taken @takealook97 claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
libracoder/kiri#1139 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
libracoder/kiri#1136 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
foundry-rs/starknet-foundry#4733 ·
Maintainers usually reply within 4 days
-
autofix:working
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
roc-lang/basic-webserver#277 ·
Maintainers usually reply within 1 day