joshua0: (Default)
[personal profile] joshua0
tl;dr: you can boot TWRP on some bootlooping Nexus 5Xs if you are really careful and use the image that I provide. Skip to the instructions if you don't care to hear me blather. And if you liked this, you might also like the hard mode version.

Yesterday evening, my Nexus 5X (a refurb from July 2016, after the fingerprint sensor on my original October 2015 Nexus 5X failed) succumbed to the disease that seems to take all of them: while I was at dinner, I sent someone a message, and as I hit "send", the device hung, got shot by the watchdog timer and rebooted, displayed the "Google" logo, and continued to cycle through being shot down by the WDT and rebooting over and over again. This failure mode is apparently very common in these devices, and is known as the dreaded "bootloop"; it is so widely known that the Google Store has indefinitely extended the warranty period for devices matching these symptoms, and the Nexus 5X subreddit is basically overrun by bootloop posts.

The actual root cause, as far as I can tell, is not publicly known. There has been a lot of speculation about what causes it, and what triggers it, and what exacerbates it -- and there are a lot of very hocus-pocus remedies to attempt to prolong the life of the device, or to recover from it. Indeed, information about this seems scarce even inside Google; reliable sources indicate that for a time, microkitchen refrigerators were full of Nexus 5Xs, in an attempt to stave off issues while updating the devices. All that seems to be certain is that the "bootloop" is a hardware defect. There seem to be many different syndrome families of bootloop. For instance, some devices seem to exhibit unusual behavior before they fail entirely (perhaps reporting "no SIM card", or having touchscreen issues); some devices fail in a fashion that is temperature-sensitive or voltage-sensitive (freezing the phone can give some extra life, or discharging the battery to a low percentage can also give the phone some extra time); and some devices fail in a fashion that seems to indicate storage issues (there's no temperature or other sensitivity, and the system usually crashes when trying to read from storage). There seems to be a long tail of symptoms, but the "temperature-sensitive" case seems to be the most common.

In any event, that is the bucket that mine fell in. Mine would boot into recover for about five or six seconds after being put in the freezer, but did not last long enough to mount the filesystem, let alone get data out of it. One enterprising user on XDA-Developers noted that low-battery-voltage cases caused the system to disable the Cortex-A57 (high-power, high-performance) cores, and experimented with a patched kernel that forced the phone to only run on the Cortex-A53 (low-power, low-performance) cores, and lo and behold, found that doing so allowed his phone to boot.

I tried booting his boot.img on my phone, and sure enough, it at least got to the boot progress spinner. But, really, I wanted all the data from my phone, not to boot my phone up and potentially corrupt more stuff if it crashes. So, I used mkbootimg_tools to tear apart the boot.img that he supplied, and also to tear apart a TeamWin Recovery image. Then, I glued the TWRP ramdisk into the "A53-only" boot.img using the same mkbootimg package; and after I had an A53-only-plus-TWRP boot.img, I booted that on my phone. And sure enough, TWRP booted without trouble, and I could pull data off my phone! (For good measure, I wrapped it in an ice pack while it was mirroring, just in case.)

how to pry data out )
Page generated Jun. 23rd, 2017 08:50 pm
Powered by Dreamwidth Studios