samedi 3 septembre 2016

I just wanted to update CM! (or, how do I restore a raw backup, in any capacity)

So I'll start at the beginning as to how I got into this mess.

Earlier in August, a new snapshot of CM13 was pushed. I hadn't gone through the CM update process on my Nexus 6 yet, seeing as I got it in late May. So I cheerfully downloaded the update and, when ready, started the update.

Soon enough, the phone rebooted into TWRP. So far so good.

TWRP prompted me for my password to decrypt my data partition, so I entered my PIN. After a short delay, the TWRP log notified me of successful decryption...and then TWRP crashed, rebooting the phone. A few minutes later, I was back into CM, un-updated.

After tinkering with it a bit more, I discovered that canceling the TWRP password prompt allowed me to get into the recovery proper. But now, not being totally sure of how encryption worked, I didn't know if going through with the update flash would do anything bad while the data was encrypted. (Plus, y'know, the downloaded image was in the encrypted data.) So I left the whole issue alone for a few weeks, while I moved across the country in preparation for college.

When I got some spare time after moving, I figured that I might as well do a full backup of the phone and attempt the update regardless. If I had a copy of the data, I could just revert any catastrophic accidents, right? I couldn't just do a standard backup through TWRP, though; obviously I couldn't use the internal storage, and my only USB storage device big enough to hold all the memory was NTFS-formatted. (As I understand it, TWRP only supports NTFS in read-only mode; it wouldn't even mount my external hard drive at all, possibly because it had two partitions.)

So last night, I poked around and found this guide on this very forum. Full backup with dd over USB, just the thing I needed! I hooked up my phone to my laptop and got to work. A couple hours later, mmcblk0.raw was safely on my computer, in all its 29.1 GB glory.

Now it was time for the actual update. Since I already had the phone connected to my computer, I decided to try sideloading. I grabbed the latest CM snapshot, put TWRP into sideload mode, and ran adb sideload. It seemed to be going fine...until TWRP decided to flash the image before it had even received the whole file (according to adb).

Confused, I booted the phone normally. I noticed the newer-looking "optimizing apps" screen as promised in the CM update, which was a good sign. But after I got past the "enter PIN to start Android" screen and returned to the boot logo, that was it. At one point during the second stage of boot, my laptop managed to halfway recognize the phone and give it a "safely remove hardware" option, but the phone itself remained hung (or at least, I'm pretty sure it was). Not good.

I tried a couple more times to get the update to install properly. Trying CyanogenMod Recovery didn't help; it jumped the gun on the sideload just like TWRP did. Finally, I replaced TWRP and stuck the CM update snapshot on an old flash drive, and installed it from there. Somehow, no dice.

At this point, it was getting pretty late, and specifics start to fail me now. But I decided I ought to just restore the backup and try again from there (or not, depending on how I felt afterward). I couldn't find an easy way to reverse the process from the guide above through ADB, and I didn't have a FAT32 device large enough to hold the entire image (a 32 GB card I have falls just a few hundred MB short).

I tried splitting the file into parts, only to realize I needed parts smaller than 4 GB thanks to FAT32 restrictions. So I started the splitting process and went to bed.

Now it's today. I had to figure out how to write those 4 GB chunks to the phone sequentially, then swap them out for another set, then start writing again from where I left off. The first set went smoothly, chaining together multiple dd commands and redirecting their output directly to /dev/block/mmcblk0. I thought I had it figured out, and I even wrote a shell script for the next set, this time using seek offsets:
Code:

dd bs=1024 if=mmcblk0.001.000 of=/dev/block/mmcblk0 seek=14680064
dd bs=1024 if=mmcblk0.001.001 of=/dev/block/mmcblk0 seek=18350080
dd bs=1024 if=mmcblk0.001.002 of=/dev/block/mmcblk0 seek=22020096
dd bs=1024 if=mmcblk0.001.003 of=/dev/block/mmcblk0 seek=25690112

But now dd randomly spits out "/dev/block/mmcblk0: Invalid argument". I don't get it.

Anyway, now I'm pretty stuck, crushed by multiple layers of bad decisions, and in possession of a phone that either has totally trashed memory or just a hiccup in the middle of the data partition. (Or maybe it's good! I'm too afraid to boot it in case that wrecks it more.)

At this point, it seems like my options are thus:
  1. Try to figure out how to do what I'm apparently supposed to be doing: restore partition-by-partition (which I'm not sure I can even do in this state depending on what TWRP is willing to mount??)
  2. Find a larger USB storage device, or somehow get TWRP to mount my external hard drive
  3. Wipe the damn thing and start over
  4. Boot it and see what happens

I'm not totally opposed to 3, as I don't think I have anything I really need off of there. If I do, I do technically have the backup still, but I'm unsure of the feasibility of decrypting it on my computer (plus I'd need to figure out how to split it into partitions first). I'd rather exhaust all non-destructive options first, but if worse comes to worst and I have no phone the night before school, I'm gonna have to cave.

I would greatly appreciate it if someone took the time to point me towards a workable solution. I have a decent amount of expertise, but I'm very unsure of how to proceed from here. Also, if anyone has a clue why TWRP kept crashing after decrypting, I'd love an answer, because that one still baffles me.

Many thanks in advance!


from xda-developers http://ift.tt/2c3dPL8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire