My remedy is shsu -- a very simple patch on top of the standard recovery image that will prevent loss of root access when applying an OTA update. Here's how to install and use it:
Use at your own risk! I am not responsible for any damage incurred by following these instructions or using the linked software!
- Download flash_image and recovery-ERE22D-shsu.
- Push them to
/sdcardon the phone -- either mount the SD card and copy it or useadb push flash_image /sdcard/ adb push recovery-ERE22D-shsu.img /sdcard/
. - Execute within
adb shell:cd /sdcard/ chmod 755 flash_image su -c ./flash_image recovery recovery-ERE22D-shsu.img
Test Drive
Verify that you have installed the recovery image correctly, by rebooting into recovery mode. The easiest way:
adb reboot recoveryIn the modified recovery, you can toggle menu using the space button. You should see
[ szym ] system recovery utilityand the last option on the list should be
install shsu:
This recovery will install shsu (shell-only su) every time it exits, so after rebooting back you can check that it worked by running within adb shell:
ls -l /system/xbin/shsu -rwsr-x--- root shell 80492 2011-01-02 02:10 shsu shsu id uid=0(root) gid=0(root) groups=...This is a shell-only su, meaning that no app other than the shell (that is, adb shell) will be able to use it.
Restoring root access using shsu
It is now safe to apply an OTA update. After applying the update, you will lose root access via regular su. Assuming the (now ineffective) su binary is in /system/xbin we need to fix its permissions. Enter adb shell:
shsu mount -o remount,rw /dev/block/mtdblock4 /system chmod 4755 /system/xbin/su mount -o remount,ro /dev/block/mtdblock4 /system