USB Debugging does not work when installed
@evdenis USB Debugging does not work once this module is installed and enabled in Magisk.
This means that adbd is not starting. Reasons could be different. What android version? What phone, firmware? Does it work if you switch selinux to permissive mode?
Phone: Samsung SM-G900F Flashed+rooted, running ViperOS 6.7 Android Version: 9
I'll try setting SELinux to permissive and let you know.
Nop. Same. Setenforce is set to 0 (Permissible). Restarted the device (SELinux persist the state Permissible).
root@kali:~# adb root
restarting adbd as root
Device gets disconnected. Reattaching the cable does not work.
root@kali:~# adb shell
error: no devices/emulators found
Can I execute the module with debug (stdout/err) info from the console (I can ssh into the phone)?
Ok, found the hotfix:
Init
$ ssh root@android -p2222
(android) $ whoami
root
(android) $ adbd
Confirmation
root@kali:~# adb root
restarting adbd as root
root@kali:~# adb shell
(android) $ whoami
root
Now I'm wondering what is the issue that kills adbd on my phone. :/
same issue on samsung j2core (j260gu) 8.1.0 oreo.
Same issue on Oneplus 7T Pro Oxygen OS 10.0.12
Any error messages in dmesg? I wonder if something like https://github.com/frida/frida/issues/877#issuecomment-549636944 would work.
I wonder if something like frida/frida#877 (comment) would work.
No, it won't work. SELinux (most probably) kills adb root because this policy https://github.com/evdenis/adb_root/blob/master/sepolicy.rule is not enough on Samsung SM-G900F, samsung j2core, Oneplus 7T Pro devices.
I don't have these devices and can't debug and test the module on them.
The simplest and universal way to solve the issue on these devices is to switch SELinux to permissive mode during boot process.
The simplest and universal way to solve the issue on these devices is to switch SELinux to permissive mode during boot process.
@evdenis that does not work, see this; https://github.com/evdenis/adb_root/issues/2#issuecomment-650542332
That's why I wrote "(most probably)". I don't know the exact reason on your phone and obviously can't debug it. I only know that SELinux can kill the process or the kernel itself (on samsung devices it's true because of this code https://github.com/CruelKernel/samsung-exynos9820/blob/1039ba0bf7e89464e0b233b78f31277c6da5bdd0/fs/exec.c#L1837, https://github.com/CruelKernel/samsung-exynos9820/blob/1039ba0bf7e89464e0b233b78f31277c6da5bdd0/security/samsung/defex_lsm/defex_rules.c#L85). Maybe selinux in your case starts in enforcing mode during boot and switches to permissive too late. You can check kernel log or /proc/avc_msg file for strings like 'avc' or 'denied' or 'adb'.
The way you fixed your problem with starting adbd manually is another "indirect evidence" for me that you struggle with SELinux, because I also faced the exactly the same behaviour while writing the module. SELinux killed adbd on my phone and it was possible to start adbd manually from termux with root privileges. I solved the case by writing additional policy https://github.com/evdenis/adb_root/blob/master/sepolicy.rule that magisk injects to selinux during the boot process. This policy is enough on OnePlus 5T, Samsung S10 and these are the only devices I can test the module on.
Just in case, if you use LineageOS you don't need this module since it's possible to switch adbd root in settings.
@duraki ssh root@android -p2222 gives me ssh: connect to host android port 2222: Connection refused
So basically I connect the mobile to computer through USB. Now how do I know what port to connect to?
@leovarmak you need simplesshd on your mobile device or connect via adb shell.
@duraki Thank you so much!!! I am a QA, so incase if you ever want feedback about whatever you work now, I am here 😁