Connect locally via Magisk root #64

Open
opened 2026-05-15 15:50:26 +02:00 by Benjamin_Loison · 18 comments
Owner

Would help Benjamin_Loison/Voice_assistant/issues/125.

On my Fairphone 4 LineageOS 23.2 Termux:

adb devices
List of devices attached
sudo adb devices
List of devices attached
Would help [Benjamin_Loison/Voice_assistant/issues/125](https://codeberg.org/Benjamin_Loison/Voice_assistant/issues/125). On my Fairphone 4 LineageOS 23.2 Termux: ```bash adb devices ``` ``` List of devices attached ``` ```bash sudo adb devices ``` ``` List of devices attached ```
Author
Owner

DuckDuckGo and Google search "adb" via "root".

DuckDuckGo and Google search `"adb" via "root"`.
Author
Owner

https://chat.mistral.ai/chat/fdee6080-a1ab-44a3-9d8b-d02a54efd2d2

adb kill-server
sudo ps aux | grep [a]db
Output:
root      1580  0.0  0.0 10869216 4048 ?       Sl   10:15   0:00 /system_ext/bin/adb_root
shell     1762  0.0  0.0 10955556 7128 ?       Sl   10:15   0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0
https://chat.mistral.ai/chat/fdee6080-a1ab-44a3-9d8b-d02a54efd2d2 ```bash adb kill-server sudo ps aux | grep [a]db ``` <details> <summary>Output:</summary> ``` root 1580 0.0 0.0 10869216 4048 ? Sl 10:15 0:00 /system_ext/bin/adb_root shell 1762 0.0 0.0 10955556 7128 ? Sl 10:15 0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0 ``` </details>
Author
Owner
adbd
Output:
No command adbd found, did you mean:
 Command adb in package android-tools
sudo adbd
Output:
Command 'adbd' not found
Check your spelling and try again
start adbd
Output:
No command start found, did you mean:
 Command stat in package coreutils
 Command kstart in package kde-cli-tools
sudo start adbd
sudo ps aux | grep [a]db
Output:
root      1580  0.0  0.0 10869216 4048 ?       Sl   10:15   0:00 /system_ext/bin/adb_root
shell     1762  0.0  0.0 10955556 7128 ?       Sl   10:15   0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0
adb devices
Output:
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
sudo ps aux | grep [a]db
Output:
root      1580  0.0  0.0 10869216 4048 ?       Sl   10:15   0:00 /system_ext/bin/adb_root
shell     1762  0.0  0.0 10955556 7128 ?       Sl   10:15   0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0
u0_a190  12579  0.3  0.1 10888952 10456 ?      Ssl  13:56   0:00 adb -L tcp:5037 fork-server server --reply-fd 4
adb kill-server
stop adbd
Output:
No command stop found, did you mean:
 Command btop in package btop
 Command htop in package htop
 Command step in package step-cli
 Command stow in package stow
 Command top in package termux-tools
```bash adbd ``` <details> <summary>Output:</summary> ``` No command adbd found, did you mean: Command adb in package android-tools ``` </details> ```bash sudo adbd ``` <details> <summary>Output:</summary> ``` Command 'adbd' not found Check your spelling and try again ``` </details> ```bash start adbd ``` <details> <summary>Output:</summary> ``` No command start found, did you mean: Command stat in package coreutils Command kstart in package kde-cli-tools ``` </details> ```bash sudo start adbd sudo ps aux | grep [a]db ``` <details> <summary>Output:</summary> ``` root 1580 0.0 0.0 10869216 4048 ? Sl 10:15 0:00 /system_ext/bin/adb_root shell 1762 0.0 0.0 10955556 7128 ? Sl 10:15 0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0 ``` </details> ```bash adb devices ``` <details> <summary>Output:</summary> ``` * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached ``` </details> ```bash sudo ps aux | grep [a]db ``` <details> <summary>Output:</summary> ``` root 1580 0.0 0.0 10869216 4048 ? Sl 10:15 0:00 /system_ext/bin/adb_root shell 1762 0.0 0.0 10955556 7128 ? Sl 10:15 0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0 u0_a190 12579 0.3 0.1 10888952 10456 ? Ssl 13:56 0:00 adb -L tcp:5037 fork-server server --reply-fd 4 ``` </details> ```bash adb kill-server stop adbd ``` <details> <summary>Output:</summary> ``` No command stop found, did you mean: Command btop in package btop Command htop in package htop Command step in package step-cli Command stow in package stow Command top in package termux-tools ``` </details>
Author
Owner
sudo stop adbd
sudo ps aux | grep [a]db
root      1580  0.0  0.0 10869216 4048 ?       Sl   10:15   0:00 /system_ext/bin/adb_root
```bash sudo stop adbd sudo ps aux | grep [a]db ``` ``` root 1580 0.0 0.0 10869216 4048 ? Sl 10:15 0:00 /system_ext/bin/adb_root ```
Author
Owner
sudo start adbd
sudo ps aux | grep [a]db
Output:
root      1580  0.0  0.0 10869216 4048 ?       Sl   10:15   0:00 /system_ext/bin/adb_root
shell    13487  1.0  0.1 11070244 7872 ?       Sl   13:57   0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0
```bash sudo start adbd sudo ps aux | grep [a]db ``` <details> <summary>Output:</summary> ``` root 1580 0.0 0.0 10869216 4048 ? Sl 10:15 0:00 /system_ext/bin/adb_root shell 13487 1.0 0.1 11070244 7872 ? Sl 13:57 0:00 /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0 --tim_seclabel=u:r:adbd_tradeinmode:s0 ``` </details>
Author
Owner
adb connect localhost:5555
Output:
* daemon not running; starting now at tcp:5037
* daemon started successfully
Connection refused
```bash adb connect localhost:5555 ``` <details> <summary>Output:</summary> ``` * daemon not running; starting now at tcp:5037 * daemon started successfully Connection refused ``` </details>
Author
Owner
getprop service.adb.tcp.port
sudo getprop service.adb.tcp.port
sudo setprop service.adb.tcp.port
Output:
usage: setprop NAME VALUE

Sets an Android system property.
```bash getprop service.adb.tcp.port sudo getprop service.adb.tcp.port sudo setprop service.adb.tcp.port ``` <details> <summary>Output:</summary> ``` usage: setprop NAME VALUE Sets an Android system property. ``` </details>
Author
Owner
https://chatgpt.com/share/6a0726e9-8908-8397-a943-cc11d87d83f7 > vsock (emulator/VM only)
Author
Owner
setprop service.adb.tcp.port 5555
Output:
No command setprop found, did you mean:
 Command getprop in package termux-tools
adb connect localhost:5555
connected to localhost:5555

It may be more stable than UI wireless debugging, but I doubt so.

```bash setprop service.adb.tcp.port 5555 ``` <details> <summary>Output:</summary> ``` No command setprop found, did you mean: Command getprop in package termux-tools ``` </details> ```bash adb connect localhost:5555 ``` ``` connected to localhost:5555 ``` It may be more stable than UI wireless debugging, but I doubt so.
Author
Owner

Benjamin-Loison/android search service.adb.tcp.port does not return any open or closed issues.

[Benjamin-Loison/android](https://github.com/Benjamin-Loison/android) search `service.adb.tcp.port` does not return any open or closed issues.
Author
Owner
adb shell whoami
shell
```bash adb shell whoami ``` ``` shell ```
Author
Owner

Wireless debugging is not shown as enabled.

*Wireless debugging* is not shown as enabled.
Author
Owner

Disable Wi-Fi.

adb shell whoami
shell
Disable Wi-Fi. ```bash adb shell whoami ``` ``` shell ```
Author
Owner

After reboot:

getprop service.adb.tcp.port
sudo getprop service.adb.tcp.port
sudo start adbd
adb connect localhost:5555
Connection refused
sudo stop adbd
sudo start adbd
adb connect localhost:5555
Connection refused

is a sanity check.

sudo stop adbd
sudo setprop service.adb.tcp.port 5555
sudo start adbd
adb connect localhost:5555
connected to localhost:5555

I verified that adb connect is necessary.

sudo stop adbd

twice does not return anything.

After reboot: ```bash getprop service.adb.tcp.port sudo getprop service.adb.tcp.port sudo start adbd adb connect localhost:5555 ``` ``` Connection refused ``` ```bash sudo stop adbd sudo start adbd adb connect localhost:5555 ``` ``` Connection refused ``` is a sanity check. ```bash sudo stop adbd sudo setprop service.adb.tcp.port 5555 sudo start adbd adb connect localhost:5555 ``` ``` connected to localhost:5555 ``` I verified that `adb connect` is necessary. ```bash sudo stop adbd ``` twice does not return anything.
Author
Owner

So it seems to work as wanted, the question is now how stable is it, need to test to face it.

So it seems to work as wanted, the question is now how stable is it, need to test to face it.
Author
Owner

No need to experiment on wireless debugging particularly more than on Wi-Fi as I was already having issues on Wi-Fi.

No need to experiment on wireless debugging particularly more than on Wi-Fi as I was already having issues on Wi-Fi.
Author
Owner

For USB debugging to actually work back, have to disable and re-enable it.

It seems fine enough.

For *USB debugging* to actually work back, have to disable and re-enable it. It seems fine enough.
Author
Owner

On Termux:

adb devices
List of devices attached
adb connect localhost:5555
connected to localhost:5555
adb devices
Output:
List of devices attached
localhost:5555	device
adb shell whoami
shell

On my Linux Mint 22.3 Cinnamon Framework 13:

adb shell whoami
shell

while being on mobile data only, so can have both USB debugging and Wi-Fi-less wireless debugging.

On Termux: ```bash adb devices ``` ``` List of devices attached ``` ```bash adb connect localhost:5555 ``` ``` connected to localhost:5555 ``` ```bash adb devices ``` <details> <summary>Output:</summary> ``` List of devices attached localhost:5555 device ``` </details> ```bash adb shell whoami ``` ``` shell ``` On my Linux Mint 22.3 Cinnamon Framework 13: ```bash adb shell whoami ``` ``` shell ``` while being on mobile data only, so can have both USB debugging and Wi-Fi-less wireless debugging.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#64