Saturday, July 27, 2013

Nexus 7 4.3 OTA update failing because of /system/bin/debuggerd

When I went to flash my rooted but stock Nexus 7 with Android 4.3, the update was failing because the /system/bin/debuggerd was not the version it expected. This is apparently because stickmount does some tricky stuff with debuggerd in order to work. You get an error like this: "assert failed: apply_patch_check("/system/bin/debuggerd","1ed6f..."

I was able to fix this and get 4.3 installed. Since I couldn't find a walkthrough for this, here's what I pieced together in case others have the same problem.

First, you need the right debuggerd file. For the 4.3 update (coming from 4.2.2), you can get a copy from this XDA thread (post #4 by tiggggr).

Now to get it in the right place. There are a few ways to do this. I used adb but it can probably be done with most file explorer apps. First copy the you downloaded onto your device somewhere:

adb push /sdcard/debuggerd-4.2.2

Then you need to be able to write to the system partition, stop the debuggerd, make a backup if you want, then copy the file:

adb shell
shell@android:/ $ su
shell@android:/ # busybox mount -o remount,rw -t auto /system
shell@android:/ # stop debuggerd
shell@android:/ # cp /system/bin/debuggerd /sdcard/debuggerd-backup-old-bad-version
shell@android:/ # cp /sdcard/debuggerd-4.2.2 /system/bin/debuggerd
shell@android:/ # sha1sum /system/bin/debuggerd*
a2323a0c8e245e3879d6b8beff6b2c4802045271  debuggerd
df2e705da097e4d535b4f4d98fab3bd76601e76c  debuggerd.backup

I already had a backup copy of debuggerd in my /system/bin and you can see that now debuggerd has the right sha1 hash so the install will continue.

I had to do a similar thing to restore my build.prop from a backup on my device:

root@android:/system # cp /mnt/shell/emulated/0/build.prop.bak build.prop

[Update] Here is a copy of my build.prop that matches what the install script expects: build.prop

shell@grouper:/mnt/shell/emulated/0 $ sha1sum build*
48f7593c2ff2fa85a147639fd7b77c3bc0607249  build.prop.bak

Now to get root back...

Getting root back on my Nexus 7 was easy enough that I didn't mention it earlier, but a few people have asked. I pieced together the steps from this Google+ post and part of this XDA thread into hopefully a clearer walkthrough, if this helps anyone. You could use TWRP instead of CWM, but CWM worked fine. Note that this is for the WiFi Nexus 7 (grouper) and there are different downloads for the GSM / 3G version (tilapia).

1. Download SuperSU from here and copy it (I used adb push) to the Nexus 7
adb push ~Downloads/ /sdcard/
2. Download the latest CWM recovery from here
3. Flash CWM recovery:
fastboot flash recovery recovery-clockwork-touch-
4. Reboot into CWM recovery and pick the "recovery" option
5. Flash the file from /sdcard
6. When the device reboots, if it asks if you want to disable flashing stock recovery, answer No.

You should have root back.

If, like me, you have the same issue updating to JWR66Y from JWR66V, here is a forum post with the right debuggerd.

I also had a permissions error (set_perm: some changes failed) but following this post, I unrooted before applying the update (using CWM) and it worked.