can't mount /data while installing LineageOS


Question

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.)


Answer

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.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes