Digital beach
My little place on the web
Digital beach Blog / Articles Categories Tech Tips "debuggerd has unexpected contents"
"debuggerd has unexpected contents"

The upgrade to android 4.4.3 seemed to fail on my Nexus 7 2013 tablet. All went well, the tablet downloaded the update, rebooted, and...... showed me a dead android indicating the update failed.

When rebooting the tablet it still was on 4.4.2.

So what to do when an update fails? Let's investigate!

The log of the update process is available in the folder /cache/recovery/last_log. Unfortunately you need to be root to access this folder, so looking at the file will only succeed on "Rooted" devices. Below the contents of the last_log found on my Device



Screenshot last_log

As you can see the update failed because there seems to be something wrong with the file "debuggerd". It has "Unexpected contents". The update gives this message because the sha1-hash isn't what the update script expects. When android runs an update it patches the files on the filesystem, before patching it checks to see if the file it's gonna modify is the same as the original the patch is supposed to work against. At my tablet the hash of debuggerd is different from the original file that came with the 4.4.2 release of android.

So how do we fix ? : Replace the file with the original. 

I've got the original file from the original firmware for the Nexus 7 2013, found at [https://developers.google.com/android/nexus/images#razorkot49h]. I extracted it from the System.img file, which contains the filesystem for the system partition (mounted at /system at runtime).

Getting the file onto the device

While the first challenge was to find the correct version of the file, the next challenge is getting this version onto the device. I will be using a recovery image to perform this action. As my device is rooted it has an unlocked boot-loader.

Step 1, creating a backup of the current debuggerd file

It would be wise to create a backup of the current debuggerd file. Even when we know the current version isn't the correct one. To do this use the Android Development Kit (adb) to get a shell at the device. This will only work when you have a "Rooted" device. The default permissions on debuggerd are read-write only by root.

So connect the device to the computer and open a shell by executing: adb shell

Next, execute the following commands:


su
cd /system/bin
mount -o rw,remount /system
cp debuggerd debuggerd.backup.<date_of_backup>

If you want to create the backup somewhere else rather then at the /system partition it's not necessary to remount the /system partition.

Step 2, getting the correct version onto the device

The first step is to get the right version of debuggerd onto the device. As it is in use at the /system partition we can't copy it over the original. Else it would be just remounting the system partition read-write and copying it there. So the first step will be putting debuggerd at the sdcard using adb.

Just use the adb push command to push the correct version to the sdcard:


adb push debuggerd /mnt/sdcard/

Step 3, copying the correct version using openrecovery.

When the file is on the device we can copy it into the correct location (/system/bin). This can be done by using the openrecovery tool from Team Win. The latest version can be downloaded at [http://teamw.in/project/twrp2] I've used an older version for my Nexus device.

When you have the image for the recovery tool downloaded put your device in recovery mode (power off, power on while holding volume down).

Android recovery mode

When the device is in recovery mode (and connected to your computer execute the recovery image via fastboot)

fastboot boot


When your device is booted from the recovery image we can copy the debuggerd file from the sdcard to the system partition. First we need to mount the system partition.

Use the "Mount option" and check the System option.

Check System

Now we can use the file manager to copy the debuggerd file from the sdcard to the folder /system/bin

Reboot the device and wait until it notifies you again that the android version can be updated (this can take a while because the regional update schedule will be used) and try again. Or flash the update yourself using the android tools.