4

I've rooted my Nexus 7 using the SO instructions How do I root my Nexus 7?. I'm trying to install LineageOS using its instructions https://wiki.lineageos.org/devices/flo/install#installing-lineageos-from-recovery. But steps 4 and 6 fail (making a backup, and wipe / advanced wipe). Both failures include the messages Failed to mount '/data' (Invalid argument) and Unable to mount storage. So /data may be corrupt.

From adb shell, ls /data shows that it's an empty directory; mount /data fails with the same error Invalid argument.

From adb shell, the Nexus 7's /etc/fstab mentions /dev/block/mmcblk0p30 /data ext4 rw 0 0. But when I try to repair that device with e2fsck, it finds no superblock, even with -b 8193.

From adb reboot bootloader, the screen shows SECURE BOOT - enabled and LOCK STATE - unlocked. From that fastboot screen, if I select recovery mode, I see the teamwin TWRP 3.1.1-0 splash screen for 30 seconds, then I "swipe to allow modifications," and then I see TWRP's 8 big buttons.

Well, the backup and wipe buttons fail, so just for giggles, I tapped the button Install (LineageOS steps 7-10), and chose the lineage and open_gapps .zip files that I'd adb pushed to /sdcard. To prevent the install from working, checked the checkbox "verify zip signature" without copying over the md5 files containing the signatures. Besides the expected failure to verify the signatures, I saw these errors:

Failed to mount '/data' (Invalid argument)

Unable to recreate /data/media folder

E:Could not create /cache/recovery/

Unable to mount storage.

Can't open destination log file: '/cache/recovery/log'

Unable to mount /data/media/TWRP/.twrps

E:DataManager::Output_Version -- Unable to make /cache/recovery

Again, /data seems to be the problem. I probably shouldn't attempt a real install before taking care of that.

How should I recover from these errors, to install LineageOS or, failing that, to restore the device to factory defaults? (If it helps, I have another Nexus 7, unrooted.)

12
  • 2
    Can't you just reflash stock and try again? Head to go, collect 200M?
    – Dan Brown
    Commented Jul 6, 2017 at 21:27
  • Thanks for the jargon "reflash stock!" Searching for that and "nexus 7" finds dozens of recipes, which might get me unstuck. But if I've learned anything in my recent adventures, it's that I'm not deep enough in Android culture to evaluate which recipes are trustworthy. This n00b would like to buy a vowel from Vanna with his 50 rep! Commented Jul 6, 2017 at 21:32
  • Hahaha! I'm glad I loaded this site up for the first time in a while. "Stock" would be the default ROM-flashing it would be similar to what you are trying to do with lineage, but I think you use fastboot instead. Once you have got back to working, ye can try again. Mistakes are good, and so is stuff hitting the fan-just make sure you keep an eye on serial numbers, they are your friend ;p
    – Dan Brown
    Commented Jul 6, 2017 at 21:39
  • 1
    OK, a proposed answer is: follow the recipe at developers.google.com/android/images to "reflash stock," and then retry rooting it and installing LineageOS. Commented Jul 6, 2017 at 22:19
  • 1
    @beeshyams, yes, my TWRP is for my device "flo." I even edited android.stackexchange.com/questions/37760/… to that effect. Commented Jul 7, 2017 at 2:10

2 Answers 2

12
+50

These /data-related errors are likely because TWRP can't decrypt the current /data partition. This often happens with stock ROMs, since TWRP is only made to handle the encryption method of AOSP.

To work around it, in TWRP, choose Wipe - Format Data. This will wipe all data from the device, but at the same time remove encryption and allow you to start off fresh. You can then reboot to recovery again to check if there are still errors displayed, and if not (it shouldn't), proceed with any other flashing actions.

5
  • @beeshyams I only came to know that a few days ago when my Tab S2 arrived and I was having trouble setting it up. Just the right time to share :D
    – Andy Yan
    Commented Jul 8, 2017 at 15:14
  • It isn't always necessary to wipe the data partition even if TWRP can't decrypt it. If the ROM you're going to flash able to handle that, it is possible to flash a ROM to the system partition from TWRP in spite of not being able to mount /data.
    – Caleb
    Commented Mar 6, 2019 at 7:57
  • @Caleb Yeah, as you said, depending on the stock encryption and ROM to be flashed. AFAIK, for Samsung/Xiaomi at least, not the case...
    – Andy Yan
    Commented Mar 6, 2019 at 8:47
  • Of course going from stock manufacturer ROMs to something custom, this is unlikely to work. But TWRP has trouble initializing decryption on on some AOSP based ROMs too (such as Lineage OS 15.1 on OnePlus devices) — the point of making a comment here for people searching for this problem is that the error decrypting /data isn't fatal to being able to flash a ROM if the ROM itself is going to be able to do that properly (e.g. in the case up upgrading Lineage 15.1 to 16). Finding this post on a search almost made be despair of my data, which in my case was easily recoverable.
    – Caleb
    Commented Mar 6, 2019 at 10:24
  • @Caleb Fair enough. Blame the maintainer of your device's TWRP for not even supporting AOSP decryption.
    – Andy Yan
    Commented Mar 6, 2019 at 10:36
1

I had this encrypted volume problem as @andy-yan decribes, but couldn't boot into TWRP far enough to wipe data and remove encryption.

I had to reinstall a stock rom from https://developers.google.com/android/images and confirm that encryption was disabled in settings -> security before trying again to install lineageos.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .