Reviving a 'stuck' Google Nexus 7 (2012) from Lollipop Issues

There has been a lot of social media and even mainstream media attention to the various problems people are encountering with the Nexus 7 (2012. 2013) tablets especially after upgrading to "lolipop" (5.1). Indeed the issue has become so prevalent that there is a hastag (#nexus7bricked) on Twitter, Google Plus, and Reddit. The device is no longer supported and is of course well and truly out of warranty.

Having experienced such brickedness myself and having found a solution, it is only right and proper that information is shared so we can all pool our collective knowledge and work out how to reach to the stars & etc.

I'll begin by noting that I am not a big tablet user; a little but of Ingress, some usage of the Duoling application, the occassional webpage, or usage of an SSH in an emergency. Nevertheless, it was after playing some Ingress that the application simply "froze" for far too long and required powering off. After turning it back on again, the notorious four-coloured dots spun around for eternity without starting the operating system. This was not good. Several initial basic steps were undertaken, including ensuring that it had a power source, doing a few power-cycles on the device, and even leaving on the boot up screen overnight. None of these worked; it was a brick.

Now if one is noting that before brickness that their device is running unacceptably slow, it may be worthwhile (after backing up your data) to do a Factory Data Reset. This is achieved by navigation from Settings > Backup and Reset > Factory Data > Reset Tablet > Erase Everything. It is a very good idea to disable the setting for SD card encryption before doing this if you have that enabled.

But if your device is in the same state mine was, you'll have to try a hard reset. This erases applications as well as data, including the contents of the internal SD card. Whatever firmware is installed will remain in place, which sometimes actually is the cause of the problem. Firstly, turn off the tablet. Then turn is back on again with the volume down key selected. This will open a menu which, by navigating with the volume buttons and selecting with the power button, one can make some selections. The sensible choices to start with is to boot into Recovery Mode; from there by selecting Power and Volume Up simulatenously (just once!) one view the logs and look for what exactly has gone wrong, wipe the cache partition, and if that doesn't work, do scroll to "wipe data/factory reset" and press Power to select it. Yes, it is a grim moment.

Viewing of the logs on my device revealed the following:

I've checked the logs and I find the following quite pertinent.

__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!

..
can't open /dev/tty0: No such file or directory

..
ro.build.version.releases=5.1.1

At this point you'll have to flash a original factory firmware image to the device. To this download connect the device via USB to your computer, download the Android SDK and update it (./android update sdk --no-ui), and export the platform-tools path, download the image, extract, and unzip, and unlock the bootloader. e.g.,


# export PATH=$PATH:/usr/local/src/android-sdk-linux/platform-tools/
# wget https://dl.google.com/dl/android/aosp/nakasi-jdq39-factory-c317339e.tgz

(This was for Android 4.22)


# tar xvf nakasi-jdq39-factory-c317339e.tgz
# cd nakasi-jdq39
# unzip image-nakasi-jdq39.zip

Ensure the device is turned on and connected. At this point I tried to restart the bootloader (adb reboot bootloader), but I had to do it through the key combination method instead (power, volume down) and unlocked the bootloader. After this unlock fastboot. You probably will want to lock it again when you're finished.


# fastboot oem unlock

After entering the confirmation, you're good to flash the image. From the extracted directory simply run ./flash-all.sh. This may work for you. It didn't work for me, as follows:


# ./flash-all.sh
..
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Creating filesystem with parameters:
Size: 30080499712
Block size: 4096
Blocks per group: 32768
Inodes per group: 8160
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 7343872
Block groups: 225
Reserved block group size: 1024
Created filesystem with 11/1836000 inodes and 159268/7343872 blocks
Creating filesystem with parameters:
Size: 464519168
Block size: 4096
Blocks per group: 32768
Inodes per group: 7088
Inode size: 256
Journal blocks: 1772
Label:
Blocks: 113408
Block groups: 4
Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
--------------------------------------------
Bootloader Version...: 4.23
Baseband Version.....: N/A
Serial Number........: 015d3248bc43f406
--------------------------------------------
checking product...
OKAY [ 0.030s]
checking version-bootloader...
FAILED
Device version-bootloader is '4.23'.
Update requires '4.18'.
finished. total time: 0.199s

It was suggested that I try the 4.4.4 image. On the first run I a similar failure.


# wget https://dl.google.com/dl/android/aosp/nakasi-ktu84p-factory-2c6e4d6f.tgz
# tar xvf nakasi-ktu84p-factory-2c6e4d6f.tgz
# cd nakasi-ktu84p
# unzip image-nakasi-ktu84p.zip
# ./flash-all.sh
...
(bootloader) Bootloader is already unlocked
OKAY [ 0.022s]
finished. total time: 0.023s
erasing 'boot'...
OKAY [ 0.112s]
finished. total time: 0.112s
..
..
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Erase successful, but not automatically formatting.
Can't determine partition type.
FAILED (command write failed (No such device))
Erase successful, but not automatically formatting.
Can't determine partition type.
FAILED (command write failed (No such device))
--------------------------------------------
getvar:version-bootloader FAILED (command write failed (No such device))
finished. total time: 0.000s

The bad thing at this point was I couldn't even get into recovery mode to check the logs; the device was in a worse state from when I started. But of course, when one encounters errors arising from a shell script, the sensible thing is open it up and go through the process one step at a time.


# ./flash-base.sh
..
# fastboot oem unlock
# fastboot erase boot
# fastboot erase cache
# fastboot erase recovery
# fastboot erase system
# fastboot erase userdata
# fastboot flash bootloader bootloader-grouper-4.23.img
# fastboot reboot-bootloader

All of these succeeded. Now for the moment of truth, as it is a task which takes somewhat longer.


# fastboot -w update image-nakasi-ktu84p.zip
fastboot -w update image-nakasi-ktu84p.zip
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Creating filesystem with parameters:
....
....
Created filesystem with 11/1836000 inodes and 159268/7343872 blocks
Creating filesystem with parameters:
...
...
rebooting...
finished. total time: 165.738s

Goodness, it actually worked. Now to reinstall and get my favourite applications to work I had to upgrade to 5.0.2 with some trepidation. But at least I'm back to having a working tablet.