Open tomac4t opened 2 years ago
@xhdix provide a workaround on Slack is work for me:
pkg install proot
termux-chroot
./miniooni example
An example output:
~ $ termux-chroot
~ $ ./ooniprobe-linux-arm64 geoip
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ GeoIP lookup ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛
[engine] iplookup: using ubuntu
[engine] sessionresolver: http3://cloudflare-dns.com/dns-query... Post "https://cloudflare-dns.com/dns-query": generic_timeout_error
[engine] sessionresolver: system:///... ok
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ asn: AS56046 ┃
┃ country_code: CN ┃
┃ ip: [Redacted] ┃
┃ network_name: China Mobile Communications Corporation ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
[engine] sessionresolver: [{"URL":"system:///","Score":0.9000000009099101},{"URL":"http3://cloudflare-dns.com/dns-query","Score":9.090099090900013e-9},{"URL":"https://doh.powerdns.org/","Score":0},{"URL":"http3://dns.google/dns-query","Score":0},{"URL":"https://mozilla.cloudflare-dns.com/dns-query","Score":0},{"URL":"http3://mozilla.cloudflare-dns.com/dns-query","Score":0},{"URL":"https://cloudflare-dns.com/dns-query","Score":0},{"URL":"https://dns.quad9.net/dns-query","Score":0},{"URL":"https://dns.google/dns-query","Score":0}]
@bassosimone pointed it out that the reason is probe-cli "does not use getaddrinfo
, which means the Go code is trying to search for /etc/resolv.conf which is missing on the platform".
@xhdix 's screenshot:
~ $ echo $PREFIX
/data/data/com.termux/files/usr
~ $ cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
~ $ cat $PREFIX/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
~ $ termux-chroot
~ $ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
Thanks a lot! So, I think the core problem here is that we're cross compiling and cross compiling prevents us from linking with libc
therefore the "system" resolver provided by Go does not use getaddrinfo
but rather attempts to parse /etc/resolv.conf
, fails, and then we see the failure you documented. I see two solutions here:
do not cross compile miniooni but rather compile using the Android C compiler so we can link with getaddrinfo
https://github.com/ooni/probe/issues/2119
write a custom DNS resolver that bypasses the one that Go would use when we're not linking with libc
and such a resolver will have pre-configured UDP resolvers such as 8.8.8.8
, 8.8.4.4
, etc etc https://github.com/ooni/probe/issues/2118
I will certainly do 1, because it seems to me the most logical fix. I am unsure about 2, but I felt like documenting the idea anyway and put it into the icebox for future consideration.
Also, I think I should modify my normal workflow to include Termux on Android into the equation.
Thanks a lot for letting me know about this issue!
(Moved from the Slack thread for better tracking this issus.)
Describe the bug
To Reproduce
System information (please complete the following information):
Additional context
Termux 0.118.0 from F-droid: https://f-droid.org/en/packages/com.termux/