While cleaning, I came across an old Nexus 7 (2013, Wifi) tablet. Support for this device ended a while back and it is stuck on Android 6. I had stopped using it at the time because it had gotten slow and I had no immediate use for it any more. I have long been wanting to give installing a custom ROM (basically: installing a different OS/Distro) a try and I suddenly felt inspired to do so.

Now this was the first time I did this and a learning experience, so rather than make this a well structured tutorial blog post kind of thing, instead I will just reproduce and augment the notes I took while doing this.

The endeavour was a little frustrating, but I got there in the end.

Another thing to note is that LineageOS also stopped supporting the Nexus 7 a while back. This is their page for this specific Nexus 7. The last official ROM is from 2019: LineageOS 14 (Android 7.1.2). However, user “followmsi” on the XDA forums has a LineageOS 20 for us to use and that is what I will be working with (see also an accompanying blog post of sorts for it). I am not rehosting the files provided by followmsi, so if that ever changes or goes down, good luck.

Some final specifications. This is the Nexus 7 (2013, Wifi). There is also a version that can take a SIM card and there was also a 2012 version, also coming in Wifi and SIM versions). There are two code names that you will see pop up a few times when dealing with the Nexus 7 from 2013.

  • flo is the 2013 version with just Wifi
  • deb is the 2013 version with also SIM card capability

Anyway, let’s get into it.

The Notes

Install adb and fastboot on your computer. If you have homebrew on macOS, this is a simple

brew install android-platform-tools

On the Nexus, enable developer options (in the settings menu, tap the build number till it says they are enabled). Then go to the developer options and enable USB debugging.

Connect your Nexus to your computer with a cable. adb should pick up on it, which you can see in the list you get with

adb devices

Use adb to get to the bootloader screen.

adb reboot bootloader

Next, we unlock the Nexus 7. If I recall correctly, this deletes all the data on your tablet.

fastboot oem unlock

You will get a prompt on the Nexus. Select yes to unlock the bootloader. You will not see a confirmation on the tablet’s screen, but the fastboot command on your computer will spew output in your console. It took about 2 minutes on mine to finish it. Note it will still say that “Secure Boot” is enabled, but that apparently does not matter.

In the next step, I flashed TWRP on it. I would not do that again. Instead, read on.

Next, we flash TWRP onto the Nexus. I used the TWRP provided by followmsi since it seemed tailormade for this device.

fastboot flash recovery twrp-3.7.0_9-1-flo_followmsi.img

TWRP (Team Win Recovery Project) (Github repo) (page talking specifically about this device) is a community ROM that you can use to perform some device maintenance. Think along the lines of formatting partitions and installing other ROMs. The idea is to install it, do your maintenance, then install the custom ROM we really want.

Now restart the device.

fastboot reboot

… and I got into a bootloop. The device would start up, you could see TWRP logo, then a brief error in a console in TWRP, then reboot. I caught enough of what it said to figure out what was going wrong.

Could not mount /data and unable to find crypto footer.

Basically, it seems my /data was encrypted. My bad, it was mentioned that you could not have that. There was also a Github issue in the TWRP repo, but that did not seem to help me to fix this problem. Now I was stuck here for a bit because I could not get the tablet to stay on long enough to be able to flash other things on it. Eventually I realised I was using the wrong button pressing to get back to the recovery menu. I was pressing power button and volume up, but I needed to be pressing power button and volume down. This gets you to the same screen as the reboot bootloader command from earlier on. That in turn meant the device stayed on and I could use fastboot commands again. I was a bit stumped here and decided to reinstall stock Android, then try again.

Luckily, Google stills provides the stock ROMs for their devices. The code name for this device’s ROM is razor. I downloaded their most recent version and unzipped it.

├── bootloader-flo-flo-04.08.img
├── flash-all.bat
├── flash-all.sh
├── flash-base.sh
└── image-razor-mob30x.zip

From the folder, I simply executed the steps from the flash-all.sh script. I copy its contents here.

fastboot flash bootloader bootloader-flo-flo-04.08.img
fastboot reboot-bootloader
sleep 5
fastboot -w update image-razor-mob30x.zip

So in essence it installs stock bootloader, then installs the stock OS. Next, I rebooted the device again.

fastboot reboot

After reboot, an animation of an android pops up on the screen doing… something. Then the device automatically restarts and it seems to be starting up the default Android system. The stock Nexus 7 is starting up animation starts showing and it takes a loooong time. I thought I broke it again, but I just let things run. It is a frustrating experience with their “whimsical” boot screen that provides zero information.

After several minutes, I get to the first time setup screen of the stock Android. I go through the steps, then go re-enable USB debugging.

Next I briefly tried installing TWRP as an app, it also provides an apk. However, this is pointless if your device is not rooted. It cannot do anything.

Instead, I turn off the device, then get back to fastboot with power button and volume down. Next, I gave running TWRP as bootloader another try. Rather than flashing it onto the device however, I just used fastboot to boot from the image. If it failed again, then I would not have another frustrating bootloop.

fastboot boot twrp-3.7.0_9-1-flo_followmsi.img

This time, TWRP did start up without issues. Hurrah! Use the slide unlock to give it write permissions.

Before continuing, go into TWRP settings and turn off screen timeout. What follows will be less annoying that way.

Now in the TWRP interface on the tablet, I tried following some of the steps.

  • Press “Wipe”, then “Factory reset”.
  • Press “Wipe”, then advanced wipe, select the “system” partition and repaid or change it. Then I changed it to ext4 thinking it would also format it.

Next, I use the LineageOS zip that I got from that forum post. Using the standard “Android File Transfer” program, I copy over the zip file to the Nexus. Choosing “Install” in TWRP gives me an error. It suggests to wipe Dalvik and Cache. Doing that through TWRP and then retrying “Install” still gives the error.

I take a step back.

Press “Wipe”, “Advanced Wipe”, select the system and cache partitions, then swipe to wipe them.

Next, I try sideloading the LineageOS zip file.

Press “Advanced”, press “Sideload”, swipe to sideload. Then on your computer, run

adb sideload lineage-20.0-20230830-UNOFFICIAL-flo.zip

Does not work, I get an error with the helpful message “1”.

I realise it probably has to do with the system repartitioning. With the newer Android versions, more space is needed for /system/ than is present in that partition. However, I cannot figure out how to do that in TWRP. Realise the forum post offers a sysrepart_1380_20.zip. I am not a fan of having to run opaque files in order to get basic things done, but I guess that is the way things work here.

Again enable the sideloading in TWRP if you had turned it off before. Now sideload it from your computer.

adb sideload sysrepart_1380_20.zip

In the TWRP console on the tablet you will see output appearing of it repartitioning the Nexus’ drive.

When that is done, I try sideloading the LineageOS zip file again. It does not work and gives me an error about mounting /data (flashbacks).

Have you tried turning it off and on again?

I poweroff the Nexus, then boot into fastboot again (power button and volume down). Rerun the earlier command in order to boot in TWRP since I did not flash it onto the device this time around.

fastboot boot twrp-3.7.0_9-1-flo_followmsi.img

Go into TWRP settings and turn off screen timeout again.

Try the sideloading of LineageOS yet again and… stuff is happening! A progress bar appears in TWRP. There is output on the console about system patching and other things.

Eventually that finishes and I think I am good? The forum topic mentions installing GApps (to work with Google Apps, but on this first try I want to see if I can avoid that) as well as installing Magisk (some tool related to rooting, but I am not quite seeing the point of it at the time of writing).

Instead, in TWRP I press to reboot the device. TWRP gives me a warning saying there is no OS installed. I am pretty sure that is what we just did, so I ignore the warning to see what’s what.

LineageOS loading screen appears and I am dropped into the first-time setup. Tada, you are good to go!

From here on you can go many ways with what apps to install. My advice after a bit of playing around: a better browser (firefox provides APKs you can download, you are on ARMv7 if you need to make a choice between APKs) and something to sync files over from another device.

Thoughts on the Experience

  • It is a lot of following random posts and vague descriptions relying on prior knowledge. There is no obvious source of documentation that I stumbled upon. Makes it frustrating.
  • Along the same line: unlike when working with, say, a Linux distro, you have to just find files all over the place, not maintained in some nice repository.
  • There seems to be quite the reliance on “run this magic script”. Reminds me of using Windows waaaay back when and running random .exe files was a normalised way of getting basic “advanced” things done.
  • I like digging into the files and stuff, this is not always simple with a mobile device.
  • Because it was a lot of “run this and hope”, I cannot easily verify that I listed every single necessary step in this text. I also, for now, do not want to restart the process just to verify this post. I hope for you (and potentially, future me), that the text is complete.