Nexus 7 2013 WiFi (flo) freezes and/or bootloops when booting TWRP


Question

I unlocked my Nexus 7 2013 WiFi (flo)'s bootloader and flashed the latest TWRP (3.5.1_9-0 at the time of writing), but now it freezes on the boot/splash screen and reboots after waiting. I can use adb shell to access it, in there I see errors like this repeated over and over:


<3>[  305.099060] EXT4-fs (mmcblk0p30): VFS: Can't find ext4 filesystem
<5>[ 305.158416] type=1400 audit(1620032012.811:24): avc: denied { read } for pid=172 co
<5>[ 305.158416] type=1400 audit(1620032012.811:24): avc: denied { read } for pid=172 comm="recovery" scontext=u:r:recovery:s0 tcontext=u:r:recovery:s0 tclass=netlink_kobject_uevent_socket permissive=1

What might I do to get TWRP working?


Answer

I want to preface this by saying that the following is what worked for me. I can't guarantee it will work for you, but I wanted to document it here for the future in case I need it again or someone else finds it useful. I take no responsibility the possibility of this messing up your device even worse or not doing anything at all. I don't really understand why this worked for me.




First of all, reboot the device so that you're freshly in the TWRP recovery when you start executing the commands. The device seems to randomly reboot when in this state and it wouldn't be nice if that happened while re-creating the partition, so give yourself as much time as possible.


You will need adb on your PC to follow these steps. Explaining how to acquire it is out of scope for this guide, but I'm sure you can find instructions for your operating system online.


Note that you should not include the $ and # when running the commands!


Once TWRP's splash screen appears on the device, quickly run this command on your PC:


$ adb shell

Make sure you start the adb server with the right permissions before you try this as starting it up takes some time.


Following that, run this (in the adb shell):


# mke2fs /dev/block/mmcblk0p30

This formats the userdata partition. Let this finish. For me, the device rebooted right after, but you may need to do it manually.


After the reboot, you should be booting back into Android assuming you have a working Android ROM on the device. If it seems to be stuck, wait a few minutes. If it still seems to be stuck, try giving the power button a short press. This worked for me for some reason. After this, set up the device, go into settings, enable USB debugging, and run this on your PC:


$ adb reboot bootloader

After this, flash TWRP 2.8.1.0 (Not sure whether this is necessary):


$ sudo fastboot flash recovery twrp-2.8.1.0-flo.img

Boot into it and observe it boot Android instead for some reason.


$ sudo fastboot reboot recovery

Reboot back into the "bootloader" (fastboot):


$ adb reboot bootloader

Now flash the latest TWRP again.


$ sudo fastboot flash recovery twrp-3.5.2_9-0-flo.img

And it should work. However, in my case, I have to re-flash TWRP after every boot of Android.


I'm not sure whether it is necessary to flash the older TWRP version for this to work, but I thought I'd include it just in case.




Credit goes to this forum post for giving me a vague outline on what to do: https://forum.xda-developers.com/t/q-flashed-twrp-and-now-cant-find-ext4-filesystem.3096502/ (archived version: https://web.archive.org/web/20210503093052/https://forum.xda-developers.com/t/q-flashed-twrp-and-now-cant-find-ext4-filesystem.3096502/)


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