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?
1 Answer
Two different sides of the card deck:
- apps need the
su
binary 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 build.prop
file: 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
-
-
-
@Gizmo you could guess that from the code box: it's part of the SuperUser package. The
su
binary alone won't be much useful without the app controlling it.– Izzy ♦Jun 23, 2018 at 18:10