There is an experimental build of LineageOS 14 which can upgrade from CyanogenMod 13 but I thought this was a good opportunity to clear some of the cruft off my phone and start again.
Backing up the phone
There were only a few files on my phone I wanted to copy off. All my photos, contacts and calendar are synced with NextCloud so I already had them backed up.
But I wanted to get a copy of the seed values from Google Authenticator and I wanted to keep a copy of my text messages1.
To pull out the Google Authenticator database you need to enable adb and root access2.
To do this go into Setting > About Phone and tap on 'Buld Number' 7 times.
Then go back and go into Developer options.
Scroll down to root access and pick ADB only.
Scroll down to Debuguging and switch Android debugging on.
Next you need to install ADB onto your computer, for me on Arch Linux that was as simple as
sudo pacman -S android-tools
for Debian / Ubuntu that should be
sudo apt-get install android-tools-adb
Once you have adb installed you can connect your phone via the USB cable. You may need to accept a prompt on your phone to connect adb and trust the computer and the you can run
adb root adb pull /data/data/com.google.android.apps.authenticator2/databases/databases authenticator.db
This will pull out your Google Authenticator database out. It's just a simple sqlite database and you can have a look through it.
SQLite version 3.18.0 2017-03-28 18:48:43 Enter ".help" for usage hints. sqlite> .tables accounts android_metadata sqlite> select * from accounts; 1|Gmail|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|0|0|0 2|GitHub|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|0|0|0 3|Amazon Web Services|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|0|0|0
simiarly we can now pull out our old text messages database with.
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db
and have a look through them
Whipe the phone
We reboot the phone into TeamWin Recovery mode by holding the volume down key while booting. Then press the volume up and down to scroll to Recovery mode and click the power button.
Then pick Wipe. I personally did Advance Wipe and picked all the partitions. I don't think this was necessary but I think it's cleaner to start off with a compleatly blank phone.
Flash the new firmware
Next we flash the new firmware.
Reboot again, and hold the volume down key but this time wait at the menu where it says Reboot bootloader.
When I first ran
fastboot devices I got an error message
fastboot devices no permissions; see [http://developer.android.com/tools/device.html] fastboot
But running it as root worked. I downloaded and flashed the vendor image, radio firmware and bootloader.
sudo fastboot flash vendor vendor-n2g47h.img sudo fastboot flash radio radio-angler-angler-03.81.img sudo fastboot flash bootloader bootloader-angler-angler-03.67.img
Now we reboot into into TeamWin Recovery mode.
Use adb to push a copy of lineage-14 onto the phone
adb push lineage-14.1-20170501-nightly-angler-signed.zip
and pick Install then select the zip file and follow the prompts.
Now we reboot then wait ... wait some more .... then after about a minute when your just starting to think "Oh Jeez I've bricked my phone" you will be greeted by the LineageOS boot screen.
I'm a bit of a hoarder with my data, storage is so cheap and it's so easy to keep it all forever. Signal has disappearing messages and it's a great idea, some conversations ephemeral but I just can't bring myself to delete my message history. ↩
Just incase it's not obvious enabling root access is a horible idea from a security point of view, I'd only do it when necessary and remove it again straight away. ↩