I am trying to root my android 6.0.1 phone using the following method:

I first booted into a TWRP image using fastboot boot, then using the TWRP terminal I copied the su binary from the SuperSU kit to /system/xbin/ and ran chmod 6755 ./su, chown root:root ./su and chcon u:object_r:system_file:s0 ./su. Now I booted into Android and opened a terminal emulator and goto /system/xbin/ and see that the SUID bit is set for su. But when I run su, nothing happens and the binary exits with a 0 value.

Running strace su shows that the setresuid() and setuid() calls are failing. I suspect this is because of SELinux contexts.

What should the SELinux contexts be for the binary?


Impossible to say with that little information. You said:

...and ran chmod 6755 ./su, chown root:root ./su and chcon u:object_r:system_file:s0 ./su

This seem to imply you are already root. If it's SELinux problem, you shouldbe able to see this in logcat -b main *:V.

  • I am root in the TWRP terminal, but not in Android. – nom May 22 '17 at 16:36
  • What I am asking is, what should be the correct SELinux context for the program. – nom May 22 '17 at 16:40
  • Also, please elaborate on what information you would require. – nom May 22 '17 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.