I recently purchased an Android TV box that claimed to come "pre-rooted", however there is no SuperSU apk or SU binary installed. The interesting thing is that I am automatically logged in as the root user when I connect to the device with ADB (I can run reboot commands etc), which tells me that I have at least some level of root access. Can anyone explain how this might have been set up and how I can grant root privileges to my apps as well?
Related: If a user debug build comes with adb root access by default, does it contain the su binary?, How to grant certain apps root permission through ADB?– Andrew T. ♦May 7, 2022 at 11:06
Two different sides of the card deck:
- apps need the
subinary to be able to use "root powers"
- the ADB daemon does not; it gains root access while being started by the system in the corresponding mode
The latter is a simple setting in your device's
ro.secure=1 (default on most devices) tells the system to start the daemon in "secure mode", i.e. not with root powers – while
ro.secure=0 would turn off that security and run the daemon "as root" – which will be the case with your device.
Knowing that, the claim of being "pre-rooted" is partially true: you can use ADB to "push" the relevant files to your device. Four steps should do it:
adb shell "mount -o remount,rw /system" adb push su /system/bin/su adb push superuser.apk /system/app adb reboot
After that reboot, your device should be "fully rooted" – and "root apps" should find everything they need to work, with you being in control of it via the superuser app.
1In addition to Izzy's response, the firmware was compiled either with "Engineer" or "User-debug" builds/flavors, because "ro.secure=0" will not work on "Production" flavors/builds– M. A.Sep 6, 2017 at 7:43
also, where can we find the relevant
subinary? Feb 11, 2018 at 21:30
where can I find the su binary?– GizmoJun 23, 2018 at 18:04
@Gizmo you could guess that from the code box: it's part of the SuperUser package. The
subinary alone won't be much useful without the app controlling it.– Izzy ♦Jun 23, 2018 at 18:10