1

I have referred to various posts but I don't think they seem to work, at all, whatsoever, when it comes to AVDs with Android 4.4 or 5.1.

I felt a need to post this.

So before posting this question, I have understood a basic need for rooting AVDs or even any device.

  • Mount /system in rw mode.
  • Push su binary; optionally busybox binary.
  • do chmod to them, say, 6755. That should be it.

I followed posts and successfully rooted AVD with Android 2.2, however, I tried to repeat the same thing for Android 4.4 or 5.1 (both with SELinux disabled), but it seems that there is some kind of fallback mechanism.

For Android 4.4 and 5.1, /system will be mounted in rw mode, but, as soon as I try to push binaries, it gets reverted back to ro mode. Furthermore, it won't get back to rw mode as well, at least until I do a reboot. I keep getting a permission denied error.

Since these worked for Android 2.2 (with a modification in filesystem type and mountpoint), I intend to execute following commands (for Android 4.4 and 5.1):

adb root
adb shell /system/bin/mount -o rw,remount -t ext4 /dev/block/vda /system
adb push su /system/xbin/su
adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su

Anyone who has managed to root AVDs running these versions of Android are requested to help me in this.

I have experience with Android Studio & Windows.

3

I have tested and found that irrespective of the version of Android, if the ABI is arm, armeabi or maybe even mips (not sure), the process of rooting is going to work. They didn't worked for me, as of now, if the ABI is x86 or x86_x64 for Android 4 and 4+.

Below, anything after "#" is supposed to be a helpful comment.

Testing working on - Android 1.x, 2.x, 3.x, 4.0, 4.1, 4.2 (add additional space in subsequent boot):

adb shell mount
# Preferred command: adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
adb shell mount -o rw,remount /system
adb push su /system/xbin/su
# Appropriate su binary from Chainfire's SuperSu.zip package.
adb shell chmod 06755 /system
adb shell chmod 06755 /system/xbin/su
adb install "Super user.apk"
# Update the su binary for sure.
#adb install "Rootchecker app OR Terminal Emulator app to test."

Testing working on - Android 4.3-4.4 (add additional space in subsequent boot), 5.1, 6.0:

adb shell df
# See the available space in /system
adb shell mount -o remount,rw /system
adb push su /system/bin/su
adb shell chmod 0755 /system/bin/su
adb push su /system/xbin/su
adb shell chmod 0755 /system/xbin/su
adb shell su --install
adb shell "su --daemon&"
adb shell setenforce 0
# optional and recommended; adb shell mount -o remount,ro /system
adb install "Super user app"
# Update the su binary.
#adb install "Rootchecker app OR Terminal Emulator app to test."
  • You know that x86 and ARM require different binaries, right? There's no way a binary compiled for ARM would work on android-x86. – Dan Hulme Feb 8 '18 at 12:51

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.