I’ve been tracking the viability of using an Android phone without using Google Play Store-related binaries for a while, and when my Nexus 5 started prompting me to upgrade to Android 6 I reckoned the time had come to give CyanogenMod a shot.
I encountered a few surprises along the way, so I thought it might be useful to others if I detailed how I went about this process.
Initial setup
I started with a plain 32GB Nexus 5, unrooted but encrypted, running Android 5.1.1. The computer I used to drive this runs Debian testing.
Backing up
Over time I’ve accumulated a fair amount of data on the phone, and I wanted to make sure I got some of my information back after the switch; in particular:
- my contacts
- my agenda
- my podcasts (I use AntennaPod)
- my text messages (I use SMSSecure)
- my FreeOTP keys
- my ConnectBot keys
Most of the other applications I use can retrieve their settings remotely, although I found it useful to restore them (as we’ll see later).
Contacts, agenda and tasks
Since I wasn’t planning on restoring access to my Google account on the phone, before switching I configured the phone to sync contacts, agenda and tasks locally. This involved installing DAVdroid on the phone and Radicale on the computer; Linux Crumbs provides detailed instructions, as does Enrico Zini. It’s worth installing Tasks before DAVdroid if you want to sync tasks as well.
Photos, ebooks etc.
I’ve been using
Syncthing
to copy my photos from the phone every time it’s on the home wi-fi
network. To make sure I grabbed as much data as possible, I simply
added sync locations mapped to various directories under /sdcard
(Android, Books as well as DCIM which was previously synced).
adb backup
Installing CyanogenMod involves using adb, so it needs to be
installed anyway; it also provides a means of backing up applications
and data from the phone and restoring them later. On Debian, install
android-tools-adb (and android-tools-fastboot while at it) and add
your user to the adb group. On the phone, activate
USB debugging.
Then when the phone is connected over USB,
adb devices
should show it.
For the actual backup I used
Adebar; this allows backing
up system components and user applications individually, which makes
restoring things much simpler. I connected the phone, created a backup
folder on the computer, and ran adebar-cli which generated a number
of scripts. Then I ran the userbackup script to back up all the
applications. (As a side-note, if you want to poke around the backup
files, check out
Android Backup Extractor.)
SMSSecure
For SMSSecure I exported the text messages and retrieved the generated
file using adb pull.
Installing CyanogenMod
CyanogenMod’s installation instructions are quite easy to follow. I tried being clever and initially used the CyanogenMod recovery image instead of the TeamWin Recovery Project (TWRP) image linked in the instructions, but that failed; using the TWRP image worked fine.
The various reboots can take a surprisingly long time, around ten minutes in some cases; there’s no need to worry, just leave the phone to finish what it’s doing.
Restoring
Installing F-Droid
The first step for me was installing F-Droid (that’s now my primary source for applications, instead of the Google Play Store).
Restoring applications
Instead of re-installing them from scratch via F-Droid, I used adb
restore to restore AntennaPod, ConnectBot,
Episodes,
Firefox,
FreeOTP,
K-9 Mail
and
Twidere.
I cheated somewhat and restored a few applications I still use which
aren’t available on F-Droid (mostly because they’re non-free); in most
cases adb restore worked fine for that. Of course I won’t get
automatic updates for these...
I also installed the Humble Bundle Android client.
“App not installed”
A few applications (notably Super Hexagon)
wouldn’t install on CyanogenMod; starting the installer and tapping
“Install” simply resulted in an “App not installed” message. After
some investigation (adb logcat ended up being the most useful tool
here), it turns out this is a
known bug in CyanogenMod 12.1.
Fixing it involves a root shell to specify that the default
installation location for applications is the Nexus 5’s internal
memory:
- enable root for applications in the developer options
- enable the terminal in the developer options
- find the terminal in the applications, and start it
- become root by typing
suthen Enter (and allow it to become root in the confirmation dialog) - fix the installation location by typing
pm set-install-location 1 - disable root in the developer options
The setting is remembered across reboots.
In future posts I’ll detail some of the nice features of CyanogenMod, and my selection of favourite free software applications.