[DEVICE] Pixel 8 pro - ETIMEOUT
Device Information
- Device model: Pixel 8 pro
- Android version: Android 16
- Architecture: aarch64
- Kernel version: 6.1.145-android14-11-gfa1d6308d1fe-ab14691759
- Termux version/source: F-Droid v0.118.3
- Which path(s) tested: A: native Termux (bare claude
- Node.js version: v24.17.0
- Claude Code version: 2.1.193
Status
- [ ] Works fully
- [ ] Partial (some features broken)
- [ x ] Fails to work
Notes
It starts but can't connect to anthropic server even though curl works via v4 and v6.
Unable to connect to Anthropic services Failed to connect to api.anthropic.com: ETIMEOUT
had this issue too, narrowed it down to high dns lookup load, c-ares in Bun tries to lookup /etc/resolv.conf, doesn't exist on bionic, so falls back to 127.0.0.1 (nothing listening here).
glibc getaddrinfo does read the termux /etc/resolv.conf, so it does work there. Bun therefore has one good resolver and one broken one, and eventually you starve the good one.
strace output:
openat("/etc/resolv.conf", O_RDONLY) = -1 ENOENT
sendto(fd, <dns query for api.anthropic.com>, ... 127.0.0.1:53)
recvfrom(fd, ...) = -1 EAGAIN # x22, never answered
penat(".../glibc/etc/resolv.conf") = ok # getaddrinfo path -> 8.8.8.8 (works)
to fix: you can either run a background dnsmasq to permanently listen 127.0.0.1 -> normal DNS, auto-start at boot via your root boot mechanism or, i tried patching the binary directly, bit hacky but works:
printf 'nameserver 8.8.8.8\nnameserver 8.8.4.4\n' > /sdcard/dns.conf
off=$(grep -abo '/etc/resolv.conf' "$BIN" | head -1 | cut -d: -f1)
printf '/sdcard/dns.conf' | dd of="$BIN" bs=1 seek="$off" conv=notrunc
# then re-run: patchelf --set-interpreter <glibc ld> "$BIN"
(uses a tmp path in /sdcard, for non-root you might need termux-setup-storage. i'm sure there's a better solution)
also not too sure what triggered this, since i only started having this issue recently.
could make a script that patches the binary and replaces the old one in place if anyone wants, but the permanent solution is to bake it as a patch into the script.
I am getting it intermittently on my primary device as well and am hoping to be able to deep dive into it the next 24ish hours.
Thank you for the issue and to the detailed comment to help point me in the right direction.
Right now I am not locked in on root cause but my intuition is pushing me towards bun again however that has little evidence to back it up.
I am getting it intermittently on my primary device as well and am hoping to be able to deep dive into it the next 24ish hours.
Thank you for the issue and to the detailed comment to help point me in the right direction.
Right now I am not locked in on root cause but my intuition is pushing me towards bun again however that has little evidence to back it up.
To save you some time, what I did was look at strace output when the binary runs, then look for queries to 127.0.0.1 vs. an actual DNS. If you see lots of the former, i'm 100% sure it's because of broken resolver files. If you don't get that, I might be having another separate issue and you can just ignore this.
I actually thought of a better solution than what I had before if it turns out it is Bun, just change dns.setServers in preload/NODE_OPTIONS, bake it into a temp script and specify BUN_OPTIONS="--preload <path>", much better than a patch and no temp dir needed. Tested and works for me. Happy to make a PR if needed.
@Tanbeer191 that'd be great if you would like to. I hope to carve a few hours out tonight to bust out the lab and get my devices testing this and another fix but right now I am operating in small spurts as it turns out when you come back from vacation you have more work than you left with.
Thanks again for helping keep the repo positive and hopefully helpful for others wanting to use it!