• android
  • rom

Upgrading an old Nexus 7 to android 10

Nexus7_LineageOS17.1

A friend at work gifted me an old Nexus 7 (2013) which originally shipped with android 4.3, but had gotten official updates up to 6.0.1. I knew when he offered it that it was very likely I'd be able to get a more recent version on there since the official Google devices are very well supported and I was right! Installing android 9 was pretty easy by using LineageOS (LineageOS is what is left of Cyanogenmod). There are a bunch of blog posts here referencing Cyanogenmod over the years, and I had a lot of fun with these and other custom android roms over the years.

The Nexus 7 (2013) needs to be repartitioned to install android 10 though which makes this upgrade a bit more difficult. As usual, following the directions closely is key. I connected the Nexus to a laptop running Ubuntu which I had never used for this before so I needed to install the android debugging tools, then check that I could see my tablet connected, then to check that I could log into it:

sudo apt-get install android-tools-adb android-tools-fastboot
adb devices
adb shell

Before I wiped it, I wanted to pull some Pictures off and make sure I had a copy of Solidexplorer an app I own and have used for years.

adb pull /storage/self/primary/Pictures/ ./

Then to make sure I can find solidexplorer:

adb shell pm list packages | grep solid
package:pl.solidexplorer2

Then to get the full path for it:

adb shell pm path pl.solidexplorer2
package:/data/app/pl.solidexplorer2-EYPqI1TytGznevCQ1VgfKg==/base.apk
package:/data/app/pl.solidexplorer2-EYPqI1TytGznevCQ1VgfKg==/split_config.arm64_v8a.apk

This returned two packages, base.apk and split_config.arm64_v8a.apk but all I need is base.apk. To download it:

adb pull /data/app/pl.solidexplorer2-EYPqI1TytGznevCQ1VgfKg==/base.apk
/data/app/pl.solidexplorer2-EYPqI1TytGznevCQ1VgfKg==/base.apk: 1 file pulled. 24.0 MB/s (16632378 bytes in 0.660s)

At times I got ahead of myself and needed to kill the adb server and reconnect:

adb kill-server

I also wanted to dump a complete list of the apps on the tablet in case I forgot something:

adb shell pm list packages > ./all_packages.txt

Then the fun began. Boot up in the bootloader, check that I can see it, and unlock the bootloader (mine was already unlocked from when I had installed 9)

adb reboot bootloader
fastboot devices
fastboot oem unlock

Then to boot the recovery image for android 10, enable adb in it and connect and create some images to pull off in case things go poorly. I am only assuming that these partition images would have been useful because I didn't need them and so, never tested that theory.

fastboot boot ./lineage-17.1-20210111-recovery-flox.img
adb shell
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemst1.img
dd if=/dev/block/mmcblk0p3 of=/sdcard/modemst2.img
dd if=/dev/block/mmcblk0p4 of=/sdcard/persist.img

adb pull /sdcard/modemst1.img
adb pull /sdcard/modemst2.img
adb pull /sdcard/persist.img

This is where things went off the rails because I didn't follow the instructions. After re-partitioning you have to format the system partition which I didn't and I ended up doing this step maybe 4 times before I realized what I was forgetting, did it, and it just worked. The re-partitioning is done by sideloading a package that basically issues all the parted commands so you don't have to which is nice. You do need to log in on adb shell and type modify to kick it off.

fastboot boot lineage-17.1-20210111-recovery-flox.img
adb sideload ./flo-deb_clamor_repartition_20201203.zip
adb shell
modify

Finally you can boot into recovery again and sideload the actual image for android 10!

fastboot flash recovery lineage-17.1-20210111-recovery-flox.img
adb sideload lineage-17.1-20210111-nightly-flox-signed.zip
Nexus7_LineageOS17.1_apps

Then install solidexplorer and F-droid which I use instead of Google Play Store. I guess I should mention that the purpose of the tablet is to display sheet music primarily but also for some light reading and reference. This is not my primary device and so I don't need email or other Google Apps on it. I do install OSMand+ (Open Street Maps), VLC so I can access and play media off my home server, and of course muPDF so I can view PDFs.

adb install base.apk
adb install F-Droid.apk

Most importantly I use Termux to install git and openssh so I can check out my lyrics and sheet music repo on the tablet. Then I can view all that in Solidexplorer which has viewers for most file types built in, as long as I remember to set up Termux correctly so I can check out the repo into the downloads folder which solidexplorer can access. The following command in Termux sets up the symlinks for that to work right:

termux-setup-storage

and installing the aforementioned linux apps in termux:

pkg install git
pkg install openssh

So far its working well. Had to reboot after enabling auto-rotation to get that working (which worked fine in LineageOS 16.1 and I hope will work as well in LineageOS 17.1), but so far everything works as it did under 16. Someday I hope to get an e-ink tablet for this purpose (to carry all my music and lyrics to events and sessions) but until then, the battery life is still good enough for a few hours of jamming so I call it a win!