Open broetchenrackete36 opened 2 years ago
Is there any information I could provide that could help solve the issue?
Hmm, I don't have device on which this reproduces, so for collecting information we could try:
Switching to IPv6 DNS, put nameserver 2001:4860:4860::6464
(Google DNS64) and comment out remaining lines by preceding them with #
in /etc/resolv.conf
. If it didn't work revert to previous settings before next experiments.
Running Termux's ping inside prooted distro (proot-distro login alpine -- /data/data/com.termux/files/usr/bin/ping google.com
)
Also please provide strace of ping (successfully) running outside proot on your device
Is there any information I could provide that could help solve the issue?
a new command is made called
pinghelp
with the latest commits to help users out withping
; Can you testping
with this command, and share your results from this brand newpinghelp
command after refreshing your system withsetupTermuxArch re
please?
Originally posted by @SDRausty in https://github.com/SDRausty/TermuxArch/issues/291#issuecomment-1028616029
The Termux packages
dnsutils
,lynx
andstrace
can be helpful in diagnosing network issues. The commandtelnet
can assist as well.
@broetchenrackete36 installing Arch Linux in Termux PRoot is superfluous as the command setupTermuxArch bloom
can deposit helper script pinghelp
in $HOME/arch/usr/local/bin
; limited dns help is touched upon at present.
I don't know by whom my comment was minimized, nor why, and for what reason; Can you please explain your actions and how these actions are helping Termux, and in this case Termux PRoot grow and mature?
Your comment was off-topic to this issue, it looks more like advertisement for your own tool. OP was not running alpine, not arch, so I don't see how TermuxArch is relevant.
@Grimler91 thank you for replying; I will try to be clearer in future comments as to intent; Github login @broetchenrackete36 is NOT the only Termux user that is still having issues with ping
and dns
services in the Termux PRoot computer on handheld environment.
The dns
and ping
topics are recurring, and vary due to different factors. Development in a general dns
and ping
for newbees in Linux in Termux PRoot in Android on device is welcome as far as I see; Do not you agree?
Changing nameserver to ipv6 didn't help unfortunately. Using Termux' ping inside proot actually works... :)
~ $ proot-distro login alpine -- /data/data/com.termux/files/usr/bin/ping google.com
PING google.com (142.251.37.14) 56(84) bytes of data.
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=1 ttl=119 time=31.0 ms
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=2 ttl=119 time=47.7 ms
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=3 ttl=119 time=47.8 ms
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=4 ttl=119 time=45.1 ms
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=5 ttl=119 time=47.2 ms
64 bytes from muc11s23-in-f14.1e100.net (142.251.37.14): icmp_seq=6 ttl=119 time=47.6 ms
^C
--- google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5009ms
rtt min/avg/max/mdev = 31.034/44.448/47.833/6.071 ms
~ $
Here is the strace of ping in Termux (working normally): https://gist.github.com/broetchenrackete36/20561b80b07e6b06226e2cae7064be26
it looks more like advertisement for your own tool
If anyone can promote a sane rooting method for Android without using 3rd party tools like Termux and similar in order to root Android, I am all ears!
This dns
issue would not have matured from ping
afaik if Termux user @broetchenrackete36 had not requested help after going through the motions of creating issue "Name Resolution fail #291" which as mentioned is a continually recurring issue for a few users of Termux on handheld smartphones still today.
Instead of simply requesting device rooting, the chosen method was to develop a ping
BASH helper script, and it was published for Termux users who want help in resolving dns
and ping
issues. This script can be enhanced to dns
and ping
configurer and helper in order to assist users within our Termux environment. Why work inspired by Termux users and published to help us grow is outright banned, deleted, minimized and thrown away by Termux dot org I would love to know?
The command pinghelp
can be expanded in order to assist with DNS issues and more; Termux inspirer @Grimler91 thank you for your hard work, inspiration and sharing; Can you please answer this question?
@Grimler91 thank you for replying; I will try to be clearer in future comments as to intent;
Great, thanks.
Github login @broetchenrackete36 is NOT the only Termux user that is still having issues with
ping
anddns
services in the Termux PRoot computer on handheld environment.
Sure, I see now that the same issue, in archlinux instead of alpinelinux, is discussed in the issue you linked to, comment is no longer hidden.
This script can be enhanced to dns and ping configurer and helper in order to assist users within our Termux environment. Why work inspired by Termux users and published to help us grow is outright banned, deleted, minimized and thrown away by Termux dot org I would love to know?
This is an open issue on an issue tracker, discussions of "work inspired by Termux users and published to help us grow" seems more suited for the different community channels or github discussions.
@broetchenrackete36 can you share output from this command strace -c ping -c 2 -n github.com
from within PRoot and without PRoot please?
~ $ strace -c ping -c 2 -n github.com
PING github.com (140.82.114.3) 56(84) bytes of data.
64 bytes from 140.82.114.3: icmp_seq=1 ttl=49 time=365 ms
64 bytes from 140.82.114.3: icmp_seq=2 ttl=49 time=111 ms
--- github.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 111.891/238.500/365.110/126.610 ms
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- -------------------
20.48 0.055236 197 279 mmap
9.90 0.026715 182 146 prctl
9.75 0.026299 153 171 mprotect
8.66 0.023373 233 100 munmap
6.06 0.016359 115 142 read
5.93 0.015985 199 80 8 openat
5.34 0.014403 182 79 futex
5.05 0.013629 170 80 8 newfstatat
4.54 0.012243 161 76 close
4.17 0.011238 160 70 fstat
3.50 0.009451 205 46 readlinkat
2.22 0.005978 175 34 rt_sigaction
1.87 0.005051 174 29 20 faccessat
1.65 0.004456 342 13 fstatfs
1.41 0.003803 181 21 mremap
1.41 0.003795 210 18 rt_sigprocmask
1.20 0.003228 1614 2 execve
1.06 0.002855 219 13 pread64
1.00 0.002684 335 8 write
0.79 0.002134 533 4 sendmsg
0.69 0.001863 465 4 connect
0.52 0.001408 176 8 getrandom
0.47 0.001277 255 5 socket
0.41 0.001117 124 9 setsockopt
0.40 0.001070 118 9 fcntl
0.31 0.000843 421 2 geteuid
0.31 0.000834 278 3 getuid
0.17 0.000453 453 1 setresuid
0.14 0.000390 130 3 ioctl
0.09 0.000241 120 2 sched_getaffinity
0.09 0.000232 116 2 recvmsg
0.08 0.000214 107 2 recvfrom
0.08 0.000203 101 2 getsockopt
0.04 0.000104 104 1 getppid
0.04 0.000096 96 1 uname
0.03 0.000075 75 1 getsockname
0.03 0.000072 36 2 set_tid_address
0.03 0.000072 36 2 sched_getscheduler
0.03 0.000071 35 2 sigaltstack
0.03 0.000070 35 2 getpid
0.03 0.000068 68 1 setitimer
0.02 0.000054 54 1 ppoll
------ ----------- ----------- --------- --------- -------------------
100.00 0.269742 182 1476 36 total
~ $ startarch l user
user09:46~$ strace -c ping -c 2 -n github.com
proot warning: ptrace request 'PTRACE_???' not supported yet
PING github.com (140.82.114.4) 56(84) bytes of data.
64 bytes from 140.82.114.4: icmp_seq=1 ttl=49 time=135 ms
64 bytes from 140.82.114.4: icmp_seq=2 ttl=49 time=339 ms
--- github.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1039ms
rtt min/avg/max/mdev = 135.363/237.427/339.491/102.064 ms
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.00 0.000000 0 4 ioctl
0.00 0.000000 0 1 1 faccessat
0.00 0.000000 0 33 9 openat
0.00 0.000000 0 31 close
0.00 0.000000 0 2 getdents64
0.00 0.000000 0 1 lseek
0.00 0.000000 0 38 read
0.00 0.000000 0 7 write
0.00 0.000000 0 4 ppoll
0.00 0.000000 0 30 newfstatat
0.00 0.000000 0 7 capget
0.00 0.000000 0 1 capset
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 4 futex
0.00 0.000000 0 1 set_robust_list
0.00 0.000000 0 1 setitimer
0.00 0.000000 0 8 clock_gettime
0.00 0.000000 0 3 rt_sigaction
0.00 0.000000 0 7 rt_sigprocmask
0.00 0.000000 0 1 setuid
0.00 0.000000 0 3 uname
0.00 0.000000 0 8 3 prctl
0.00 0.000000 0 2 gettimeofday
0.00 0.000000 0 2 getuid
0.00 0.000000 0 7 socket
0.00 0.000000 0 5 3 connect
0.00 0.000000 0 1 getsockname
0.00 0.000000 0 2 sendto
0.00 0.000000 0 2 recvfrom
0.00 0.000000 0 9 setsockopt
0.00 0.000000 0 1 getsockopt
0.00 0.000000 0 3 1 recvmsg
0.00 0.000000 0 4 brk
0.00 0.000000 0 26 munmap
0.00 0.000000 0 1 execve
0.00 0.000000 0 43 mmap
0.00 0.000000 0 24 mprotect
0.00 0.000000 0 1 prlimit64
0.00 0.000000 0 1 sendmmsg
0.00 0.000000 0 2 getrandom
0.00 0.000000 0 1 rseq
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 0 333 17 total
~ $ strace -c ping -c 2 -n github.com
PING github.com (140.82.121.4) 56(84) bytes of data.
64 bytes from 140.82.121.4: icmp_seq=1 ttl=57 time=24.1 ms
64 bytes from 140.82.121.4: icmp_seq=2 ttl=57 time=52.4 ms
--- github.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 24.151/38.305/52.460/14.155 ms
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- -------------------
13.23 0.005059 18 278 mmap
11.68 0.004466 13 326 read
9.12 0.003487 19 181 mprotect
7.00 0.002676 16 165 prctl
6.70 0.002562 26 95 6 openat
5.93 0.002268 19 118 1 munmap
5.74 0.002194 274 8 write
5.62 0.002148 20 107 6 newfstatat
5.05 0.001932 483 4 sendmsg
4.67 0.001786 30 59 readlinkat
4.39 0.001679 18 93 close
3.85 0.001473 16 87 fstat
2.26 0.000865 432 2 execve
1.66 0.000636 318 2 recvmsg
1.46 0.000559 111 5 socket
1.39 0.000531 31 17 mremap
1.36 0.000518 15 34 rt_sigaction
1.30 0.000496 27 18 rt_sigprocmask
1.20 0.000458 114 4 connect
0.92 0.000352 352 1 ppoll
0.78 0.000297 33 9 setsockopt
0.66 0.000252 7 34 24 faccessat
0.64 0.000245 22 11 fstatfs
0.57 0.000219 19 11 pread64
0.46 0.000177 177 1 setitimer
0.40 0.000153 17 9 fcntl
0.35 0.000134 67 2 recvfrom
0.27 0.000102 34 3 ioctl
0.26 0.000101 50 2 futex
0.16 0.000061 15 4 getrandom
0.14 0.000055 27 2 getsockopt
0.11 0.000043 21 2 geteuid
0.10 0.000039 13 3 getuid
0.08 0.000032 16 2 sched_getscheduler
0.07 0.000027 13 2 set_tid_address
0.07 0.000027 27 1 getsockname
0.07 0.000027 27 1 setresuid
0.07 0.000025 25 1 uname
0.06 0.000022 22 1 getppid
0.06 0.000022 11 2 getpid
0.06 0.000022 11 2 sigaltstack
------ ----------- ----------- --------- --------- -------------------
100.00 0.038227 22 1709 37 total
bluemond16:53~$ strace -c ping -c 2 -n github.com
proot warning: ptrace request 'PTRACE_???' not supported yet
ping: github.com: Temporary failure in name resolution
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.00 0.000000 0 1 1 faccessat
0.00 0.000000 0 29 7 openat
0.00 0.000000 0 32 close
0.00 0.000000 0 1 lseek
0.00 0.000000 0 21 read
0.00 0.000000 0 3 write
0.00 0.000000 0 12 ppoll
0.00 0.000000 0 1 newfstatat
0.00 0.000000 0 23 fstat
0.00 0.000000 0 7 capget
0.00 0.000000 0 1 capset
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 futex
0.00 0.000000 0 1 set_robust_list
0.00 0.000000 0 8 clock_gettime
0.00 0.000000 0 2 rt_sigaction
0.00 0.000000 0 5 rt_sigprocmask
0.00 0.000000 0 1 setuid
0.00 0.000000 0 3 uname
0.00 0.000000 0 8 3 prctl
0.00 0.000000 0 2 getuid
0.00 0.000000 0 10 socket
0.00 0.000000 0 8 2 connect
0.00 0.000000 0 6 6 sendto
0.00 0.000000 0 6 setsockopt
0.00 0.000000 0 3 brk
0.00 0.000000 0 5 munmap
0.00 0.000000 0 1 execve
0.00 0.000000 0 35 mmap
0.00 0.000000 0 24 mprotect
0.00 0.000000 0 1 prlimit64
0.00 0.000000 0 6 sendmmsg
0.00 0.000000 0 1 getrandom
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 0 269 19 total
Using login bluemond
please try which ping
. If the result is /usr/bin/ping
this might be an issue with Alpine's ping.
bluemond16:53~$ which ping
/usr/bin/ping
See whether asking at Alpine Linux helps as you have just confirmed that this issue should be shared somewhere upstream at Alpine Linux.
Please search alpine linux github ping
as the results should help in how to share this topic at the correct places too.
This is not a problem with alpine. It's a problem with proot.
Termux: ping works, pkg upgrade works, all fine. Proot-distro based:
Rausty's arch: ping and pacman are not working
I'd ask if following work (as I suspect issue is related to socket marking which isn't done by non-Android libc, install curl from Termux apt)
proot --bind=/dev/null:/dev/socket/fwmarkd curl 'http://1.1.1.1'
proot curl 'http://1.1.1.1'
(Should show 301 Moved Permanently
HTML page if connection has succeeded)
For DNS issues I've also had nscd
emulating script, which would forward DNS requests from GLIBC to Android (Although only GLIBC, so won't work on Alpine or programs which implement own DNS lookup), for proot-distro archlinux
path to set at end of script would be data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/run/nscd/socket
, albeit so far there were no successes in using that on devices on which similar problems occurred (which I suspect means that non-DNS traffic couldn't be established as well).
Rausty's arch: ping and pacman are not working
Thank you for sharing; I cannot confirm this, and I hope to take a much closer look into this over the weekend.
proot --bind=/dev/null:/dev/socket/fwmarkd curl 'http://1.1.1.1' proot curl 'http://1.1.1.1'
Thank you for sharing @michalbednarski:
~ $ proot --bind=/dev/null:/dev/socket/fwmarkd curl 'http://1.1.1.1'
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
~ $ proot curl 'http://1.1.1.1' <html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
~ $ proot-distro login alpine
localhost:~# ping -c 2 -n github.com
PING github.com (140.82.112.3): 56 data bytes
64 bytes from 140.82.112.3: seq=0 ttl=42 time=67.520 ms
64 bytes from 140.82.112.3: seq=1 ttl=42 time=80.417 ms
--- github.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 67.520/73.968/80.417 ms
localhost:~# uname -m
aarch64
~ $ proot --bind=/dev/null:/dev/socket/fwmarkd curl 'http://1.1.1.1'
WARNING: linker: Warning: failed to find generated linker configuration from "/linkerconfig/ld.config.txt"
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
~ $ proot curl 'http://1.1.1.1'
WARNING: linker: Warning: failed to find generated linker configuration from "/linkerconfig/ld.config.txt"
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
~ $
I'll take a look at the script.
@michalbednarski DNS traffic seems to be working, because running dig inside proot works fine. Other traffic works fine too.
According to strace ping
from initial post, connection to DNS couldn't be established, you've probably used dig
from Termux as it is not available in default install of proot-distro ubuntu/archlinux/alpine
, any tests here should be done using proot-distro login --isolated
to avoid using Termux binaries
I'd also ask for testing following to check establishing TCP connection using non-Android libc:
proot-distro login --isolated archlinux -- curl http://1.1.1.1/
(proot-distro archlinux
has curl
in default installation)
@michalbednarski i manually installed dig (bind package) with it's dependancies and it's working fine, even with '--isolated'...
~ $ proot-distro login archlinux --isolated
[root@localhost ~]# strace -c dig github.com
-bash: strace: command not found
[root@localhost ~]# dig github.com
; <<>> DiG 9.16.25 <<>> github.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27165
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;github.com. IN A
;; ANSWER SECTION:
github.com. 56 IN A 140.82.121.4
;; Query time: 36 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Fri Feb 25 22:07:51 UTC 2022
;; MSG SIZE rcvd: 55
[root@localhost ~]#
I can connect to 1.1.1.1 too:
~ $ proot-distro login --isolated archlinux -- curl http://1.1.1.1/
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
~ $
Thats odd as dig
should be using same system calls as musl resolver (used on Alpine; glibc additionally uses sendmmsg
)
Sounds like nscd.py
I've posted earlier should be usable workaround, although I've pasted wrong path, last line should be set to serve("/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/archlinux/run/nscd/socket")
, then run script outside proot and while it's running open new session log into proot-distro archlinux
Anyway, I'd ask for results of following commands:
proot-distro login alpine -- strace ping -c1 github.com
proot-distro login archlinux -- strace -f dig github.com
(These commands are using Termux strace
but guest ping/dig/libc
)
So the ncsd.py script is indeed working, at least for ping and pacman.
Here are the results of the two commands (without ncsd.py running):
Oops, not sure if your script was running or not during the commands... Here is the output with the script not running for sure:
hiiiiii, I'm excited to share that I've found a workaround for this issue I've been facing for quite some time now. While it might seem a bit unconventional, it has been effective for me, especially since I didn't rely heavily on internet access.
Here's what I did: I ran ip r
on my Termux's normal shell after installing iproute2
. Then, I copied the default gateway address and pasted it into my /etc/resolv.conf
file as nameserver <default gateway>
on proot-distro's archlinux shell. After saving the file, everything started working smoothly!
I must note that this solution is temporary, as not all routers use the same gateway address. While many routers default to 192.168.1.1, you may need to adjust it accordingly when connecting to a new router with a different gateway.
Hopefully, a permanent fix for this bug will be available soon! :3
Problem description
Programs like ping, curl or wget can't resolve URLs/hostnames inside of proot anymore. It works fine outside of proot in termux and I can reach IP addresses fine inside proot. It worked fine before, unfortunately I don't know when it stopped working, it could be after my upgrade from android 11 to 12.
Not sure how usefull these are but here are two straces, one strace of ping inside of proot (arch distro) and one outside, running proot-distro login and then ping inside: https://gist.github.com/broetchenrackete36/5880457afcdcb48a2632d19cc44b4b1e
Steps to reproduce
Expected behavior
Hostname resolution should work in proot. Additional information
I don't use Private DNS and it doesn't matter if I'm on wifi or lte/5g.