RESURRECT YOUR OLD ANDROID WITH LINEAGEOS
When Google leaves your smartphone without updates, open source and Neil Mohr save the day.
When Google leaves your smartphone without updates, open source will save the day.
There’s a joke that circulates security circles: Android smartphones are really expensive abandoned Linux distributions. It hurts, but it’s true. Android is based on the Linux kernel, making Android (more or less) a form of Linux operating system, aka a distribution. Android smartphone manufacturers tend to bash out a device, build whatever the latest version of Android is, support it for the shortest amount of time they can get away with, then abandon the owners — vulnerable to whatever zero-day attack next raises its ugly head — running for the hills, waving their wads of cash.
Take the OnePlus Two. A fine Android phone, but OnePlus dropped support two years after release, just as the Krack vulnerability struck. Tough luck, suckers! This is standard practice in the Android world. But when people are carrying their entire lives around with them on a securityhole-riddled device, perhaps it’s time to rethink the situation. So what can you do?
While you could say a failing of Android — contrasted with Apple iOS — is its easy-to-build-and-forget open-source nature, it means any group can support any devices via the Android Open Source Program (AOSP). And people do. Most famously, there was Cyanogenmod, which blossomed into a huge project, creating builds of Android supporting hundreds of devices, with far more up-to-date releases. But the project closed in December 2016, when the corporate branch that had sprung up shut down the servers that hosted the images, source code, wiki and so on. That’s where its spiritual and source code successor LineageOS rises phoenix-like from the server ashes to power your devices.
That’s the power of open source — while one group might shut down development, another is free to pick things up and carry on where they left off. It took a few months through the start of 2017 for servers to be established, websites to spin up, and development to pick up, but as we start 2018, LineageOS officially supports almost 200 devices, with many more through unofficial development. See the boxout opposite on how to find out what devices are supported, and what to consider when buying a device.
As with Cyanogenmod, LineageOS is built upon the AOSP; the devs take the latest release, which has all the Google software removed, add LineageOS’s own additions, create a build for specific devices, and roll out an image update. This means that, when a zero-day is issue announced, such as the critical Krack and Blueborne vulnerabilities, LineageOS developers can roll out an update within days, rather than the weeks, months or never-ever option big-name Android manufacturers can take, despite having weeks of embargoed warning.
So who should consider flashing their phone with LineageOS? Probably not your grandmother. We don’t like being presumptuous, but it’s probably not for her. If your device is still under warranty, wait until it’s not. This type of activity voids any cover you might have, and that would be foolish. The process will likely have your phone out of action for at least half a day; if you’ve never done this type of thing before, more likely a full day — don’t forget, there’s an element of having to reinstall all your apps, tweak things, curse when something isn’t quite right, and start again. It all takes time.
If you’ve decided that flashing LineageOS on your phone is for you, first make sure your phone is supported; there’s not much use carrying on if it’s not! Head to https:// wiki.lineageos.org/devices, and see whether your device is on the official supported list. If it is, you’re golden; if it’s not, don’t give up hope just yet. Consider this list to be tier-one supported devices; because this is open source, less popular devices can often gain support via the https://forum. xda-developers.com community.
A Google search such as “xda developers <phone model> lineageos” will garner results. Read any returned forum threads to determine how good the support is — hopefully, people will report common bugs or issues. Common issues are the phone, Wi-Fi, Bluetooth or camera not working — these typically require proprietary binaries to work that may not have been merged into early builds. Other issues include locking up, poor battery life and other quirks.
The former issues are likely to be deal-breakers, while you might decide you can live with the latter issues. Having used early builds on a number of devices, they usually work relatively well — as long as you have the basic mobile phone radio operational. But you need to decide for yourself whether an ‘alpha’ or ‘ beta’ build is going to be good enough.
1 BACK UP YOUR DEVICE
If something goes wrong, and you’ve backed up your device, you can restore it back to its existing state, data, apps and all. For the lazy, you might just want to back up your data with an app. We recommend My Backup ( play. google.com/store/apps/details?id= com.rerware.android.MyBackup), which has free and paid versions. If you know how to root your device, Titanium Backup ( play. google.com/store/apps/details?id= com.keramidas.TitaniumBackup) is more comprehensive. Do you use Two Factor Authentication (TFA) or Google Authenticator? Stop now. You’ll lose access and need to re-enable all your TFA-protected services. If you have rooted your device, you can use Titanium Backup [ Image 1] to save off the keys, then restore them afterward. Otherwise, list your TFAprotected services, and either save off the keys or turn TFA off until you’re back. For the super-lazy, Google backs up your device to the cloud to a degree; when LineageOS is installed, you’ll get the chance to log in to your Google Account and have it restore the apps and settings. Great in principle, a bit hit and miss in practice. Do you want to back up your text messages and call history? Then use a dedicated backup tool. Another good one is SMS Backup & Restore ( play.google. com/store/apps/details?id=com. riteshsahu.SMSBackupRestore). Full system images are possible, but only via a suitable recovery ROM, such as TWRP (we’ll cover this shortly) or ClockworkMod. However, unless you already have one installed, installing one requires the device being wiped in the first place. Thanks, Google!
2 GET THE TOOLS AND DRIVERS
With a suitable backup done, you’re ready to scoop out the brains of your device, and replace them with something altogether better. To perform such a delicate operation, you need the right tools. This tends to be easier on Linux, but we’ll use Windows here for simplicity. The two core command-line tools used to monkey with Android devices are Adb (Android Debug Bridge) [ Image 2] and Fastboot. You can download these from Google at developer.android.com/studio/ releases/platform-tools.html. There’s a bunch of other junk in the ZIP that you can safely ignore. Adb is designed to interface and control the Android OS — in other words, Android needs to be running on the device to work. Fastboot is a lowlevel tool that controls the basic recovery mode access, known as fastboot, on powerup — like your PC’s BIOS. The Android ADB driver for Windows is used to recognise the Android device in debug mode, so you need the correct driver. You can get a generic one from github.com/koush/ support-wiki/wiki/Android-ADB-Drivers. If your device isn’t recognised, Google maintains a list of OEMspecific drivers you can try at developer.android.com/studio/run/ oem-usb.html#Drivers. XDA developers have created an all-in-one tool and driver installer ( forum.xda-developers.com/show thread.php?t=2588979). You may want to opt for that to save your sanity!
“Make sure your phone is supported; there’s not much use carrying on if it’s not!”
3 UNLOCK YOUR DEVICE
Now we’re all primed, the first major step is to unlock your device. This wipes everything, resetting the device back to factory defaults. Consider yourself warned. Annoyingly, it seems that every manufacturer provides a different unlock mechanism — see the ‘Device Support’ boxout on the previous page for more details. We’re going to follow the default Android system that is used by Google and OnePlus. To begin, we need to activate Developer mode, and switch on USB Debugging. In Android, select ‘Settings > About’ and tap the build number seven times. A message announces that Developer mode is unlocked. Select ‘Settings > Developer option switch on USB debugging’. If there’s a OEM unlocking option available, select that as well. Once USB debugging is on, you’ve installed the ADB drivers, and unzipped the tools, connect your Android device. A security message appears on the Android device — allow the connection. Select ‘Windows’, type “CMD” and press Return. ‘CD’ to where the tools were extracted. For simplicity, you can copy Adb and Fastboot to your desktop, and just work with ‘CD desktop’. To reboot into recovery, type “adb reboot bootloader”. To unlock, type “fastboot oem unlock”. A warning appears [ Image 3] — read this, and accept the responsibility, or run screaming into the hills.
4 INSTALL A NEW RECOVERY ROM
You’ll want to reboot your Android device and log in — don’t worry about accounts, this is just so we can copy over recovery images, LineageOS, and so on. At this point, we’re concentrating on adding a custom recovery ROM. This is accessible when a device is first powered up via a key combination, such as Power and Volume Up or Down. You can also reboot into it via the Adb tool. Using the custom recovery ROM, we’re then able to flash a new OS and do complete system backups. The most commonly used recovery ROM is TWRP (Team Win Recovery Project), so head to twrp.me/Devices, and download the correct ROM for your device. If one isn’t listed, you should try searching for a Clockworkmod recovery image for your device. Copy the recovery image into the same folder as the Fastboot command. If you know how to reboot into fastboot recovery, do so. Otherwise, put the device back into USB Debugging mode, as explained in the previous step, and in a command prompt, type “adb reboot bootloader”. To flash the recovery image, type “fastboot flash recovery <image file name>”. Select to start recovery, and enter TWRP. At this point, you can boot back into ‘System’, aka Android [ Image 4].
5 COPY LINEAGEOS AND GAPPS TO THE DEVICE
As discussed, download the LineageOS build ( wiki.lineageos.org/devices) for your device. Currently (early 2018), we recommend v14.1, which aligns to Android 7.1. Android 8 Oreo is v15, and is likely somewhat experimental at this stage, but read the logs and any forums reports to make up your own mind. At this stage, you can also grab your faux Google Gapps package [ Image 5] from opengapps.org — see the boxout below-left for more details on that. Copy both ZIPs to the device — into the Download folder, say — and, no, you don’t need to unzip them.
6 WIPE CACHE, FLASH DEVICE, REBOOT
Reboot into TWRP Recovery. Type “adb reboot recovery” if you have a command prompt to hand, or power down, and use the Power and Volume combo. Wipe the Data, Cache, and Dalvik/ART Cache (this is the default), tap ‘Wipe’ and swipe to go. Not doing this can cause the install to return an error. Return to the main menu and choose ‘Install’. Select ‘Download’ and the LineageOS ZIP. Choose ‘Add More Zips’ and do the same for Gapps [ Image 6]. Swipe to flash, and kiss goodbye to old Android. Once done, do a default wipe again, then reboot into Android. The first boot can take five minutes or so.
7 ENJOY YOUR NEW OS!
Welcome to LineageOS [ Image 7]. If you want to use the cloud restore linked to your Google Account, there’s an odd quirk at the time of writing. To log on to a wireless network, you need to first choose to not restore from another device/the cloud, set up a wireless connection, then step back, and restore. Otherwise it doesn’t set up a connection, making it tricky to download from the cloud. Once LineageOS is working, you’ll have access to the Google Play Store. If your Google Account is up and running, apps are slowly restored with some settings in place. Check Security settings, tweak the Notification drawer, and perhaps get a new launcher; Nova Launcher is our favourite. We’ve mentioned root access — this is administrator level access to the Android system. It’s generally not required, and considered a security risk, which is why it’s off by default, and hard to turn on. If you want root access for backup reasons, Lineage OS makes it reasonably easy. Grab the Super User pack for your device’s architecture from download. lineageos.org/extras. Copy it to your LineageOS device, reboot into TWRP, and flash the su.zip. Back in LineageOS, enable Developer mode, if you haven’t already. You’ll see an option called ‘Root access’ — select ‘Apps and ADB mode’. Now apps can be given root access. Depending on your device, you could find you’re getting LineageOS updates once a week. Don’t feel you need to install them. You can follow the recent changes update log for your device at download.lineageos.org, along with any changes that will be merged into the next build.