remote-android / redroid-doc

redroid (Remote-Android) is a multi-arch, GPU enabled, Android in Cloud solution. Track issues / docs here
4.09k stars 294 forks source link

redroid can't connect public network, but it can connect to host network #701

Closed peilin-liu closed 1 month ago

peilin-liu commented 2 months ago

redroid can't connect public networker, but it can connect to host network

some logs

root@orangepi5pro:~# docker exec android_0 sh -c 'ping 172.17.0.1' PING 172.17.0.1 (172.17.0.1) 56(84) bytes of data. 64 bytes from 172.17.0.1: icmp_seq=1 ttl=64 time=0.132 ms 64 bytes from 172.17.0.1: icmp_seq=2 ttl=64 time=0.117 ms 64 bytes from 172.17.0.1: icmp_seq=3 ttl=64 time=0.191 ms ^C root@orangepi5pro:~# docker exec android_0 sh -c 'ping 39.156.66.10' connect: Network is unreachable

root@orangepi5pro:~# adb connect 172.17.0.2:5555 error: device offline

make sure the required kernel modules present

root@orangepi5pro:~# grep binder /proc/filesystems nodev binder root@orangepi5pro:~# grep ashmem /proc/misc root@orangepi5pro:~#

It uses memfd to replace ashmem

Collect debug logs

06-14 10:00:13.817 827 2422 D NetworkMonitor/100: PROBE_DNS www.google.com 7ms FAIL in type ADDRCONFIG android.net.DnsResolver$DnsException: android.system.ErrnoException: resNetworkQuery failed: ENONET (Machine is not on the network) 06-14 10:00:13.818 827 2423 D NetworkMonitor/100: PROBE_DNS connectivitycheck.gstatic.com 8ms FAIL in type ADDRCONFIG android.net.DnsResolver$DnsException: android.system.ErrnoException: resNetworkQuery failed: ENONET (Machine is not on the network) 06-14 10:00:13.821 177 2424 I resolv : GetAddrInfoHandler::run: {100 983140 100 983140 1073 1} 06-14 10:00:13.823 827 2422 D NetworkMonitor/100: PROBE_HTTPS https://www.google.com/generate_204 Probe failed with exception java.net.UnknownHostException: Unable to resolve host "www.google.com": No address associated with hostname 06-14 10:00:13.824 177 2425 I resolv : GetAddrInfoHandler::run: {100 983140 100 983140 1073 1} 06-14 10:00:13.826 827 2423 D NetworkMonitor/100: PROBE_HTTP http://connectivitycheck.gstatic.com/generate_204 Probe failed with exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.gstatic.com": No address associated with hostname 06-14 10:00:13.831 177 2426 I resolv : GetAddrInfoHandler::run: {100 983140 100 983140 1073 1} 06-14 10:00:13.832 827 2421 D NetworkMonitor/100: PROBE_FALLBACK http://play.googleapis.com/generate_204 Probe failed with exception java.net.UnknownHostException: Unable to resolve host "play.googleapis.com": No address associated with hostname 06-14 10:00:13.833 827 2421 D NetworkMonitor/100: isCaptivePortal: isSuccessful()=false isPortal()=false RedirectUrl=null isPartialConnectivity()=false Time=25ms 06-14 10:00:13.835 237 602 D ConnectivityService: [100 ETHERNET] validation failed 06-14 10:00:39.300 177 203 E Netd : Failed to dump IPv4 sockets struct tcp_info: No such file or directory 06-14 10:00:39.300 177 203 E TcpSocketMonitor: Failed to poll TCP socket info: No such file or directory 06-14 10:01:00.007 92 92 D hwcomposer: VSYNC event status:1 06-14 10:01:00.033 92 104 D hwcomposer: hw_composer sent 12 syncs in 119s

root@orangepi5pro:~# curl -fsSL https://raw.githubusercontent.com/remote-android/redroid-doc/master/debug.sh | sudo bash -s -- android_0 Collecting, please wait... RTNETLINK answers: Operation not supported on transport endpoint Dump terminated Error: argument "eth0" is wrong: table id value is invalid

Screenshots**

nothing

other logs

root@orangepi5pro:~# curl -fsSL https://raw.githubusercontent.com/remote-android/redroid-doc/master/debug.sh | sudo bash -s -- android_0 Collecting, please wait... RTNETLINK answers: Operation not supported on transport endpoint Dump terminated Error: argument "eth0" is wrong: table id value is invalid

debug data

redroid-debug.L9nyMPmz.gz

zhouziyang commented 2 months ago

There are many network probe failures. Did the default DNS server (8.8.8.8) accessible?

peilin-liu commented 2 months ago

There are many network probe failures. Did the default DNS server (8.8.8.8) accessible?

I forgot to mention that Docker uses cgroup v2.

ping 8.8.8.8. It works well on the host。

root@orangepi5pro:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=12.8 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=17.0 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=20.0 ms 64 bytes from 8.8.8.8: icmp_seq=4 ttl=55 time=18.4 ms 64 bytes from 8.8.8.8: icmp_seq=5 ttl=55 time=20.0 ms ^C --- 8.8.8.8 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 12.779/17.619/19.973/2.664 ms

root@orangepi5pro:~# telnet 8.8.8.8 53 Trying 8.8.8.8... Connected to 8.8.8.8. Escape character is '^]'. ‘^] telnet> ls ?Invalid command telnet>

peilin-liu commented 2 months ago

There are many network probe failures. Did the default DNS server (8.8.8.8) accessible?

Some potentially useful information:

2ce46b870a06:/ # logcat | grep -A 20 'iptables' | head -n 20 06-14 18:05:37.534 177 844 E IptablesRestoreController: iptables error: 06-14 18:05:37.534 177 844 E IptablesRestoreController: ------- COMMAND ------- 06-14 18:05:37.534 177 844 E IptablesRestoreController: *filter 06-14 18:05:37.534 177 844 E IptablesRestoreController: -nvx -L tetherctrl_counters 06-14 18:05:37.534 177 844 E IptablesRestoreController: COMMIT 06-14 18:05:37.534 177 844 E IptablesRestoreController: ------- ERROR ------- 06-14 18:05:37.534 177 844 E IptablesRestoreController: iptables-restore v1.8.7 (legacy): iptables-restore: unable to initialize table 'filter' 06-14 18:05:37.534 177 844 E IptablesRestoreController: 06-14 18:05:37.534 177 844 E IptablesRestoreController: Error occurred at line: 1 06-14 18:05:37.534 177 844 E IptablesRestoreController: Try `iptables-restore -h' or 'iptables-restore --help' for more information. 06-14 18:05:37.534 177 844 E IptablesRestoreController: ----------------------

zhouziyang commented 2 months ago

From logcat.txt, something wrong with networking.

06-14 09:43:09.285   177  1037 W resolv  : Validating DnsTlsServer 8.8.8.8 with mark 0xf0064                                
06-14 09:43:09.285   237   311 D CompatibilityChangeReporter: Compat change id reported: 161252188; UID 10066; state: DISABL
06-14 09:43:09.285   177  1037 W resolv  : Socket failed to connect: Network is unreachable                                 
06-14 09:43:09.285   177  1037 W resolv  : TCP Handshake failed: 101                                                        
06-14 09:43:09.285   177  1037 W resolv  : query failed                                                                     
06-14 09:43:09.285   177  1037 W resolv  : validateDnsTlsServer returned 0 for 8.8.8.8                                      
06-14 09:43:09.285   177  1037 W resolv  : Validation failed                                                                
...
06-14 09:43:13.311   827  1821 D NetworkMonitor/100: PROBE_HTTP http://connectivitycheck.gstatic.com/ge
to resolve host "connectivitycheck.gstatic.com": No address associated with hostname                   
06-14 09:43:13.311   827  1820 D NetworkMonitor/100: PROBE_HTTPS https://www.google.com/generate_204 Pr
st "www.google.com": No address associated with hostname                                               
06-14 09:43:13.313   237   760 D CompatibilityChangeReporter: Compat change id reported: 229362273; UID
06-14 09:43:13.314   177  1824 I resolv  : GetAddrInfoHandler::run: {100 983140 100 983140 1073 1}     
06-14 09:43:13.314  1686  1761 I BinaryDictionaryFileDumper: reinitializeClientRecordInDictionaryConten
06-14 09:43:13.315   827  1819 D NetworkMonitor/100: PROBE_FALLBACK http://play.googleapis.com/generate
olve host "play.googleapis.com": No address associated with hostname                                   
06-14 09:43:13.316   827  1819 D NetworkMonitor/100: isCaptivePortal: isSuccessful()=false isPortal()=f
06-14 09:43:13.316   237   602 D ConnectivityService: [100 ETHERNET] validation failed                 

and route table for eth0 is empty (check network.txt).

peilin-liu commented 2 months ago

DnsTlsServer

The possible reason is that it is necessary to incorporate some Android kernel code to support iptables quota2.

peilin-liu commented 1 month ago

After the iptables error was fixed, the network is working properly now. thank you very much @zhouziyang

CuiZhaoHui commented 4 weeks ago

I got the same problem,can you share your solution? @peilin-liu