Android upgrade woes
This is my little journey made upgrading an old OnePlus One (A0001) phone from KitKat (4.4 stock) to Pie (9, LineageOS 16).
I was dreading this as the last time I tinkered with flashing a new OS on an android it turned out to be an enormous pain. Thus, I've been putting this off for a couple of years now. Procrastination at its best but unfortunately some applications are not so friendly with vintage versions of Android any longer...
But surely, things must be so much better and streamlined after all this time? Since CyanogenMod doesn't exist anymore, I went to the LineageOS site to get a bran-spanking new OS and downloaded some other complementary stuff to go with:
- the latest recovery image from TeamWin (3.3.1 in this case),
- the GApp pico package (don't want more of Google's crap than minimally required),
- and the super user add-on.
The nice and short step-by-step guide on the site looked easy enough. Confidence in making short work of this enterprise grew... to then quickly shrink to the size of a one-celled organism...
Problem #1: recovery image doesn't stick around
Loading up the recovery image and rebooting failed as the default old OnePlus recovery was still there for some reasons.
sudo fastboot flash recovery twrp-3.3.0-0-bacon.img
Second and third attempt lead to the same thing. Turns out there is a setting in the developer menu in CyanogenMod KitKat that needs to be un-ticked so that the original recovery doesn't overwrite any new attempts at replacing it... -_-'
It still needed to reboot straight into recovery after flashing in fastboot
mode to make it work though.
Problem #2: Trust Zone check failed
Time to flash LineageOS! And... "Error 7". Looking at the messages it is a TZ (Trusted Zones) issue. In short the image is too new for the old KitKat era firmwares installed on the phone. Eventually, after sourcing some loose and slightly younger firmwares from XDA, it worked after flashing them individually via adb
side-loading.
sudo fastboot flash modem NON-HLOS.bin
sudo fastboot flash sbl1 sbl1.mbn
sudo fastboot flash dbi sdi.mbn
sudo fastboot flash aboot emmc_appsboot.mbn
sudo fastboot flash rmp rpm.mbn
sudo fastboot flash tz tz.mbn
sudo fastboot flash LOGO logo.bin
sudo fastboot flash oppostanvbk static_nvbk.bin
Problem #3: Instabilities
After finally getting through the installation, LineageOS' UI kept either crashing or bugging out at random. Also, transferring back the files I saved prior onto my PC onto the phone's storage proved troublesome. The file transfer (USB) kept being interrupted by a connection drop. Copying gigabytes of data on a skittish and dog slow connection is aggravating on the best of days.
After one too many UI crash I decided to try installing the last official OnePlus One Android image (Oxygen OS) instead to see if it would make things better...
Problem #4: Incomplete installation
Nope! Yet another "Error 7" but this time for a different reason: the assertion check in the install script requires "OnePlus" but found "A0001"... You can't make this stuff up. The official OnePlus One (I double checked the version) can't install on the phone it's meant to be installed to.
Alright then; uncompress, edit the assert check in the installation script to make it pass, re-zip the lot and finally side-load it in the recovery via adb
and... (the suspense!!!) ... ~50% and it fails... FML!
Fine!
Road to recovery
A new approach is required. I suspect that some of the instabilities encountered on the LineageOS previously are due at least in part with the other firmwares I flashed so I extract the firmwares from that official image (OnePlus_Bacon_OxygenOS_201601190107.zip
).
After a reboot into fastboot
mode, all of them are flashed again as before onto the device. I reboot yet again but this time into "recovery" to install the OS, GApp and SuperUser images.
And it looks like it did the trick. After re-installing LineageOS again the weird UI crashes are gone and things look stable. My suspicions were correct. The file transfer is still crap but then again it's always been my sad experience with Android.
The main thing is having the phone running an updated and stable OS.
Dark patterns ahoy!
So here I am; casually going through the Android settings and double checking Android/Google didn't just change any of the custom settings previously set under the "My Account" section of the Google website. Then, I see this... (see right) Google, you sneaky dog! That's as much a dark-pattern as you can have staring back at me in the ads setting!
To note that the little switch is on the "off" position by default which is counterintuitive to the fact that the instruction for apps to use your advertising ID to build a profile of you is "on". Here you need to switch the slider to the "on" position to turn "off" the egregious orgy of personalised data sharing.
Regrettably, as much as I'd like to exorcise Google from my life definitively, there is one application I have a hard time doing without (LocusMaps - awesome for hiking/cycling). Aside from that, FDroid offers pretty much everything else I personally use.
Final thoughts
This whole endeavour took an entire day just to keep a device ticking a little longer. It is definitely out of reach of most non-technically minded types and/or with time to spare. Most of the issues took some sleuthing around message boards, guides for different phones and a lot of reading just to get some clues as to the potential reasons.
It really shouldn't be so time-consuming and inaccessible for most people to just update a phone's operating system. Especially in mind of the nature of Android and the rather large company behind it. I realise the updating process is mostly at the discretion of the individual phone manufacturers but it is still irksome that perfectly serviceable devices are left to become obsolete purely based on the software (and near irreplaceable batteries).
It is a sad state of affairs when, on one side, we are called to be mindful of our carbon footprint and the state of the planet and, on the other, it is easier just to dump your phone and get a new one than to get it to last a little longer...
Ironically, It actually took less time to get a fresh Arch Linux installation done with all the personal customisations when my system hard drive died a couple months back.
TLDR: Just tell me the steps!
To re-iterate; this is to upgrade an early generation OnePlus One phone (A0001) from CyanongenMod based on KitKat (4.4) to LineageOS based on Pie (9).
This requires a little bit of understanding so, although it worked for me and is correct as far as I know, don't go blaming me if things go sideways with your device.
Preparations
First, make sure to have adb
and fastboot
on your computer. LineageOS's Wiki provides some help with that.
Then, download the following:
- LineageOS for OnePlus One 'bacon'
- OnePlus One's last OxygenOS image from their site (if you can't stomach the JS galore, here's a direct link)
- TeamWin Recovery image (skip to the "Download Links" section and get the latest)
- LineageOS's AddonSU package if your want root access (make sure its the 'arm' version)
- Google Apps package of your choice for the ARM platform
The Google apps are not needed to have a functional phone but if you want to use the Google Play Store they are.
To have root access you will also need to get the SuperUser package.
Unlocking the bootloader
This will erase everything on your device so back it up prior if you need to.
Note: if fastboot
throws a "no permissions fastboot
" then you will need to use elevated privileges (sudo or use the root/administrative account on your PC).
- Connect up the phone to your PC via USB and type in the console:
adb reboot bootloader
- Once in
fastboot
mode, check your PC recognises the phone with:fastboot devices
- If it is recognised then type the following to unlock the bootloader:
fastboot oem unlock
- The phone should reboot.
Flashing the recovery image
- The system should have been reset to factory. Get through/skip the initial setup and re-enable the USB debugging.
- Disable the recovery override in the developer menu - "Update CM Recovery".
- Reboot into
fastboot
mode and check it connects properly:adb reboot bootloader
- Once in
fastboot
mode, check your PC recognises the phone with:fastboot devices
- Flash the recovery image:
fastboot flash recovery twrp-{VERSION}-bacon.img
- Reboot straight into recovery mode to make sure it works:
fastboot boot twrp-{VERSION}-bacon.img
Flashing the firmwares
- Unzip the OxygenOS image from the OnePlus website and move into the unzipped directory.
- Flash all the firmwares:
sudo fastboot flash modem firmware-update/NON-HLOS.bin sudo fastboot flash sbl1 firmware-update/sbl1.mbn sudo fastboot flash dbi firmware-update/sdi.mbn sudo fastboot flash aboot firmware-update/emmc_appsboot.mbn sudo fastboot flash rmp firmware-update/rpm.mbn sudo fastboot flash tz firmware-update/tz.mbn sudo fastboot flash LOGO firmware-update/logo.bin sudo fastboot flash oppostanvbk RADIO/static_nvbk.bin
- Assuming the flashing went without error messages, shutdown the phone by holding down the power button.
- Boot into recovery by holding the power button + the volume down button together until the phone vibrates then let go of the power button.
Installing LineageOS
- In recovery mode, format and wipe ART/Dalvik partition and cache by:
- Tapping "Wipe"
- Tapping "Format Data" and following the steps
- Returning to the previous menu and tapping "Advanced Wipe"
- Select "Cache" and "System Partition" then swipe the bar at the bottom towards the right.
- Return to the main menu and tap on "Advanced" then "ADB Sideload".
- Swipe the bar right to start the sideloading functionality.
- Sideload LineageOS, the SuperUser addon (optional) and the Google Apps (optional) packages in order:
adb sideload lineage-{VERSION}-nightly-bacon-signed.zip adb sideload addonsu-{VERSION}-arm-signed.zip adb sideload open_gapps-arm-{VERSION}.zip
- Reboot device (there's a "Reboot" option on the main menu if you prefer):
adb reboot
There should be a bran-new installation of LineageOS waiting for you when the phone restarts.