Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB Debugging does not work when installed #2

Open
duraki opened this issue Jun 26, 2020 · 15 comments
Open

USB Debugging does not work when installed #2

duraki opened this issue Jun 26, 2020 · 15 comments

Comments

@duraki
Copy link

duraki commented Jun 26, 2020

@evdenis USB Debugging does not work once this module is installed and enabled in Magisk.

@evdenis
Copy link
Owner

evdenis commented Jun 26, 2020

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?

@duraki
Copy link
Author

duraki commented Jun 27, 2020

Phone: Samsung SM-G900F
Flashed+rooted, running ViperOS 6.7
Android Version: 9

I'll try setting SELinux to permissive and let you know.

@duraki
Copy link
Author

duraki commented Jun 27, 2020

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)?

@duraki
Copy link
Author

duraki commented Jun 27, 2020

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. :/

@kmanjunathk41
Copy link

same issue on samsung j2core (j260gu) 8.1.0 oreo.

@oxillix
Copy link

oxillix commented Aug 14, 2020

Same issue on Oneplus 7T Pro Oxygen OS 10.0.12

@Manouchehri
Copy link

Any error messages in dmesg? I wonder if something like frida/frida#877 (comment) would work.

@evdenis
Copy link
Owner

evdenis commented Aug 21, 2020

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.

@duraki
Copy link
Author

duraki commented Aug 23, 2020

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; #2 (comment)

@evdenis
Copy link
Owner

evdenis commented Aug 23, 2020

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'.

@evdenis
Copy link
Owner

evdenis commented Aug 23, 2020

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.

@evdenis
Copy link
Owner

evdenis commented Aug 23, 2020

Just in case, if you use LineageOS you don't need this module since it's possible to switch adbd root in settings.

@leovarmak
Copy link

@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?

@duraki
Copy link
Author

duraki commented Jan 27, 2021

@leovarmak you need simplesshd on your mobile device or connect via adb shell.

@leovarmak
Copy link

@duraki Thank you so much!!! I am a QA, so incase if you ever want feedback about whatever you work now, I am here 😁

Repository owner deleted a comment Feb 23, 2024
Repository owner deleted a comment Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants