Search code examples
androidandroid-source

AOSP on Nexus 5X: How to get root


I am working on building AOSP for nexus 5X. code builds and installs and runs,

but when trying to access adb shell, I couldn't get to su.

I checked and /system/xbin/su is now in su_exec tag, so I modified file_contexts to put su in system tag

shell@bullhead:/ $ which su
/system/xbin/su
shell@bullhead:/ $ ls -Z /system/xbin/su
-rwsr-x--- root     shell             u:object_r:system_file:s0 su

But still:

shell@bullhead:/ $ su
su: setgid failed: Operation not permitted

I also tried disabling selinux but:

shell@bullhead:/ $ setenforce 0                                                
setenforce: Couldn't set enforcing status to '0': Permission denied

I am out of ideas now. Please help.


Solution

  • adb root with userdebug build doesn't work for me.

    to get root, I had to make an eng bui. on this build, adb always lands in root shell.

    Thanks @Chris for answer.