1

I'm trying to include the SuperUser application and su binary in my ROM (by AOSP method). I'm using android-6.0.1_r79 (Marshmallow) as my base AOSP code.

[[Similar question(s) has been answered earlier, but all previous discussions were prior to Android KitKat and does not solve current AOSP/Superuser issues.]]

I followed the instructions here and after a few hiccups and with some help from Google I was able to make a successful build. I'm using the su repositories listed here.

I was able to verify that su binary present in /system/xbin was from wvengen/su.c by adding some logs. However, there was no Superuser application present in the ROM.

2nd problem I'm facing is that /system/xbin/su is accessible only to adb shell and not to other apps. By default su binary has the following permissions:

root@generic:/system/xbin # ls -l | grep su
-rwsr-x--- root     shell      488692 2017-04-16 16:20 su

I changed it to:

root@generic:/system/xbin # chmod +rx su
root@generic:/system/xbin # chmod +s su
root@generic:/system/xbin # ls -l | grep su
-rwsr-sr-x root     shell      488692 2017-04-16 16:20 su

But still other applications do not get su access

root@generic:/system/xbin # run-as com.test
root@generic:/system/xbin $ ls -l | grep su
lstat './su' failed: Permission denied

whereas all other binaries are executable (eg. /system/xbin/sqlite3) under com.test.

I also tried to change the su permissions in fs_config.c but it did not work.

So please provide me some pointers to:

  1. Understand why Superuser.apk is absent from my ROM
  2. How to make su binary available to other Applications
PC.
  • 6,870
  • 5
  • 36
  • 71
  • If you put SuperSU in priv-app, it can root the device. – NBTX Apr 16 '17 at 17:17
  • @SamMearns From where will SuperSU.apk get the su binary from? – PC. Apr 16 '17 at 17:19
  • I believe it's either embedded in the apk or it downloads it. @PC. – NBTX Apr 16 '17 at 17:19
  • Thanks @SamMearns. I'll look into this approach. I'd still like to know if my problems can be solved using AOSP approach. – PC. Apr 16 '17 at 17:23
  • @SamMearns Adding SuperSU.apk to priv-app did not work. Technically any application cannot remount system partition without proper su binary. remount is required to place su and su is required to remount. So I don't see how this approach can work! – PC. Apr 16 '17 at 17:53
  • Okay @PC. I think I got confused by SuperSU's ability to update – NBTX Apr 16 '17 at 22:13

0 Answers0