Saturday, September 27, 2014

Adventures in reviving Acer A510 Android tablet back from the dead

So the other day my Acer A510 which was just lying there on the table buzzed. And then again. And again. Every 30 seconds.

What was it? Well, it has gotten itself into a boot loop, restarting, trying to boot, dying and trying the process again.

What was the cause? I have no idea. Low battery perhaps? It is an old device.

But that's not the point. The point is to tell my adventure in restoring it back to life.

You see, I had Clockwork Mod (CWM) recovery installed. So I immediately booted into recovery (Volume down + power; after the first buzz release power;
after the second buzz release the down button and press the Volume up button until the third buzz) and tried to do a cache wipe. That did not help, so I did factory reset. And the device rebooted in the midst of it.

Well, this is fun.

I booted into recovery again, but this time I `adb shell`ed into my device, mounted /data partition and tried `rm -rfv /data/*`. The device rebooted again. Yay.

More over after I remounted /data/ I saw that the files that rm reported as removed were happily sitting there.

It turns out the ext4 file system I had there was totally borked for some reason. And the way recovery and android mounts it is like this:

# mount
/dev/block/platform/sdhci-tegra.3/by-name/UDA on /data type ext4 (rw,seclabel,relatime,errors=panic,user_xattr,acl,barrier=1,nomblk_io_submit)

See the errors=panic option there? According to the man page of mount, it states the following.
Define the behaviour when an error is encountered. (Either ignore errors and just mark the file system erroneous and continue, or remount the file system read‐only, or panic and halt the system.) The default is set in the filesystem superblock, and can be changed using tune2fs(8).
Well, this is fun. So when the system booted, because /data was corrupted, the kernel panicked, resulting in a boot loop. I have no idea why CWM mounted the partition when it was supposed to format it, but it resulted in the same behaviour.

The cure was to run the following from `adb shell` while running a recovery:

# umount /data
# /sbin/e2fsck /dev/block/platform/sdhci-tegra.3/by-name/UDA

And then I could format /data from CWM menu and flash the rom. Disaster averted. Phew.

Hope this helps someone someday.