adb connect returns "no route to host"
Closed this issue · 6 comments
Describe the bug
Hi, I tried your script as I was having trouble at the 'adb connect IP:5555' stage of connecting scrcpy wirelessly (I was receiving error message "no route to host"). Your script didn't work for me, but I'm hoping you might be able to decipher the error message I've received and be able to tell me what the issue might be on my end?
To Reproduce
Steps to reproduce the behavior:
'./ethernally.sh'
Expected behavior
Was expecting/hoping scrcpy would open and I could disconnect USB.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Linux
- Version Ubuntu 20.04.5 LTS
Smartphone (please complete the following information):
- Device: Onyx NoteAir 2
- OS: Android
- Version 10
Additional context
Here is the full log I receive in the terminal after executing the script
$ ./ethernally.sh
Running script from /opt/ethernally
touch: cannot touch '/opt/ethernally/last_working_device.conf': Permission denied
./ethernally.sh: 29: cannot create /opt/ethernally/debug.log: Permission denied
Attempting to discover any attached devices..
List of devices attached
B6B0D475 device usb:3-2 product:NoteAir model:NoteAir device:NoteAir transport_id:3
Disconnecting adb devices..
DEBUG> killing adb server..
There are no WiFi devices automatically detected/attached - as reported by ADB.
connected: false
Trying last known working device. Please have patience... (max 1 minute)
There is no last known working device.
./ethernally.sh: 462: cannot create /opt/ethernally/debug.log: Permission denied
socket: null
connected: 0
Wi-Fi seems to be turned off or ADB debugging not enabled on device.
Could not connect via WiFi, switching to USB mode
!!! READ CAREFULLY !!!
-
Please plug USB cable and enable USB debugging (To unlock the hidden Developer tools/options menu, go to Android Settings > About > Press on 'build number' 7 times. Then go to android settings > developer tools/options and enable 'USB debugging')
-
You should also check 'Disable adb authorization timeout' so that the adb authorization for systems that have not reconnected within the default (7days) is not revoked, thus to be able to reconnect in the future without interaction.
-
If asked, allow USB debugging on your Android device by allowing your computer's RSA key fingerprint. Also check the 'Always allow from this computer' checkbox to allow future connections
Checking if USB cable is connected and USB debugging enabled and authorized..
......
DEBUG> killing adb server..
restarting in USB mode
device(s) connected via USB cable: NoteAir
usb_device_serial: B6B0D475
Checking root..
/system/bin/sh: su: inaccessible or not found
Your device needs to be rooted for allowing permanent WiFi connectivity through ADB
./ethernally.sh: 100: cannot create /opt/ethernally/debug.log: Permission denied
Device is not rooted. Moving on..
restarting in TCP mode port: 5555
Attempting to start Wi-Fi on the device..
new socket: 10.248.24.86:5555
./ethernally.sh: 218: cannot create /opt/ethernally/debug.log: Permission denied
Connecting via wifi..
unable to connect to 10.248.24.86:5555: No route to host
connected: true
./ethernally.sh: 127: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 130: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 134: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 138: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 142: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 146: cannot create /opt/ethernally/last_working_device.conf: Permission denied
Device ready!
./ethernally.sh: 250: cannot create /opt/ethernally/debug.log: Permission denied
./ethernally.sh: 127: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 130: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 134: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 138: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 142: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device '10.248.24.86:5555' not found
./ethernally.sh: 146: cannot create /opt/ethernally/last_working_device.conf: Permission denied
did you have wifi enabled and connected when you tried it? also, normally you should have an IP from 192.168.0.X/24 unless you modified wifi router settings
Yes, I had both devices on the same wi-fi network when I ran it.. it's a large university network so I'm really not sure about any of the details of the IP configuration. But I got that same IP address both by checking the network settings on the device manually, and by pinging it from the command line on my PC.
depending on how the university network is configured, the port 5555 might be blocked by some kind of firewall. Can you please try connecting in home network first via ethernally to confirm this is the actual case?
I ran ethernally today on my home network and it worked. I'll paste the text from my terminal below in case it gives any clues to what the issue is on the university network. If your hunch is correct that the port 5555 is blocked by a firewall in the university network, do you have any suggestions for workarounds to get scrcpy working wirelessly on that network?
$ ./ethernally.sh
Running script from /opt/ethernally
touch: cannot touch '/opt/ethernally/last_working_device.conf': Permission denied
./ethernally.sh: 29: cannot create /opt/ethernally/debug.log: Permission denied
Attempting to discover any attached devices..
List of devices attached
- daemon not running; starting now at tcp:5037
- daemon started successfully
B6B0D475 device usb:3-2 product:NoteAir model:NoteAir device:NoteAir transport_id:1
Disconnecting adb devices..
DEBUG> killing adb server..
There are no WiFi devices automatically detected/attached - as reported by ADB.
connected: false
Trying last known working device. Please have patience... (max 1 minute)
There is no last known working device.
./ethernally.sh: 462: cannot create /opt/ethernally/debug.log: Permission denied
socket: null
connected: 0
Wi-Fi seems to be turned off or ADB debugging not enabled on device.
Could not connect via WiFi, switching to USB mode
!!! READ CAREFULLY !!!
-
Please plug USB cable and enable USB debugging (To unlock the hidden Developer tools/options menu, go to Android Settings > About > Press on 'build number' 7 times. Then go to android settings > developer tools/options and enable 'USB debugging')
-
You should also check 'Disable adb authorization timeout' so that the adb authorization for systems that have not reconnected within the default (7days) is not revoked, thus to be able to reconnect in the future without interaction.
-
If asked, allow USB debugging on your Android device by allowing your computer's RSA key fingerprint. Also check the 'Always allow from this computer' checkbox to allow future connections
Checking if USB cable is connected and USB debugging enabled and authorized..
......
DEBUG> killing adb server..
cannot connect to daemon at tcp:5037: Connection refused
restarting in USB mode
device(s) connected via USB cable: NoteAir
usb_device_serial: B6B0D475
Checking root..
/system/bin/sh: su: inaccessible or not found
Your device needs to be rooted for allowing permanent WiFi connectivity through ADB
./ethernally.sh: 100: cannot create /opt/ethernally/debug.log: Permission denied
Device is not rooted. Moving on..
restarting in TCP mode port: 5555
Attempting to start Wi-Fi on the device..
new socket: 10.0.0.104:5555
./ethernally.sh: 218: cannot create /opt/ethernally/debug.log: Permission denied
Connecting via wifi..
already connected to 10.0.0.104:5555
connected: true
./ethernally.sh: 127: cannot create /opt/ethernally/last_working_device.conf: Permission denied
error: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
./ethernally.sh: 130: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 134: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 138: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 142: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 146: cannot create /opt/ethernally/last_working_device.conf: Permission denied
Device ready!
./ethernally.sh: 250: cannot create /opt/ethernally/debug.log: Permission denied
./ethernally.sh: 127: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 130: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 134: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 138: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 142: cannot create /opt/ethernally/last_working_device.conf: Permission denied
./ethernally.sh: 146: cannot create /opt/ethernally/last_working_device.conf: Permission denied
Attempting screen mirroring..
######################################
You may unplug the USB cable if previously inserted.
######################################
Enjoy a smooth wireless experience!
######################################
scrcpy 1.24 https://github.com/Genymobile/scrcpy
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 0.8 MB/s (41159 bytes in 0.049s)
[server] INFO: Device: ONYX NoteAir (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.0.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 1400x1872
NoteAir:/ $ ../src/intel/isl/isl.c:1988: FINISHME: ../src/intel/isl/isl.c:isl_surf_get_ccs_surf: CCS for 8BPP textures with 3+ miplevels is disabled, but support for more levels is possible.
[server] INFO: Device screen turned off
glad to hear that it works on your home network which actually confirms the port is blocked by university's firewall.
first of all, I see some permission errors. it looks like you might have cloned the repo under a different user and then trying to run it as another one which does not have permission. This will cause the 'last_working_device.conf' to not be written into (which fastens connection on successive attempt) as well as debug.log which holds last connection's log.
Now for your connection to work, you could use a different port that is allowed by university. Most probably they allow port 80/443 (HTTP/HTTPS) by default for outgoing connections so you could simulate you are actually running a webserver on your phone instead of adb server on port 5555 to trick the firewall into allowing the connection. To do this open the script ethernally.sh and edit first line:
port="5555"
instead use:
port="443"
I didn't test this, let me know of the result :)
EDIT: please download next release because i had to modify the script to allow port changing on non-rooted phones.
released 4.1 Arion https://github.com/fusionneur/ethernally/releases/tag/v4.1