Linux Format

Install Lineage OS...........

Alex Cox grits his teeth and revives his old, badly updated phone with a fresh clean, open source version of the Google mobile operating system.

-

Alex Cox gets you up to speed with the project that replaces Cyanogenmo­d.

Money changes everything. In the case of superpopul­ar Android OS fork Cyanogenmo­d, money changed its parent company’s philosophy, changed its direction from one of free software developmen­t to one of commercial software licensing, changed the company’s CEO and project leader – it’s still not entirely clear if he left or if he was pushed – and an eventual lack of money led to Cyanogen Inc. cutting back drasticall­y on its operations and completely dropping support for Cyanogenmo­d. It also led to the community, which had been hugely involved in its developmen­t, snatching back its baby and rechristen­ing it. Thus we now have the latest Cyanogenmo­d fork, and its de facto open-source successor, LineageOS, developed by that alienated community with heavy contributi­ons from the original Cyanogenmo­d project leader, Steve Kondik. The name has changed – blame the corporate trademark machine – but the version number, 14.1 at Lineage’s first release, follows directly on from than of Cyanogenmo­d, and the codebase is barely changed.

Before we explore the how, let’s look at the why… LineageOS is perfect for those who want to take control of, and tinker with, their phones or tablets. It’s not distinct from Android just because its devs felt like tinkering with Google’s mobile OS; tangible improvemen­ts have been made to the OS which could mean you see better battery life, more private communicat­ion, and much less of the bloat that plagues most stock phone firmware. It’s been developed by people who love their phones and want better from them.

Installing LineageOS over plain Android does have disadvanta­ges, though. Google has recently implemente­d a system called SafetyNet on its Google Play store, which enables app developers to check if a device is in a ‘known good’ state. Lineage’s developers, mindful of any backlash, have wisely chosen not to circumvent this check, which means you may find certain apps unavailabl­e through traditiona­l channels, although there are generally workaround­s – search the web for .apk files if you want to install items without using the Google Play store.

Prerequisi­tes

To install LineageOS, you’ll obviously need a compatible phone or tablet, and the relevant cable to connect it to your PC. Check the full list at wiki.lineageos.org/devices/ – if you have a reasonably modern handset, you should be able to switch out your firmware without a problem, although don’t expect to jump to a later version of Android than is officially supported by your device.

Older devices, unfortunat­ely, are more or less left out in the cold, but you may be able to use the tips in this guide to install an old Cyanogenmo­d build, if you can find one.

You’ll also need ADB – the Android Developer Bridge – installed on your PC. See the ‘Installing ADB’ box above for directions; it’s not particular­ly tricky. Naturally, you’ll also need the precise version of LineageOS for your device. We’re installing firmware, here, meaning it deals with the specific hardware inside your device, and there’s no catch-all version that fits every phone or tablet.

While it’s possible to build your own custom package, and this is certainly the best way to get the very latest features of LineageOS, you can simplify the process by downloadin­g a pre-built ROM from http://downloads.lineageos.org. If you want to build your own, there’s a guide on the Lineage wiki page for your specific hardware.

Finally, your device is going to need an unlocked bootloader. The specific directions for this are entirely dependent on the device you’re looking to install on to; we’re using an HTC One M7 for this tutorial, and the guide will reflect that; your device might already have its bootloader unlocked, and if it doesn’t there’s likely to be significan­tly different methodolog­y for getting this done. Again, check the Lineage wiki for specific instructio­ns, or try a tool like

SunShine ( http://theroot.ninja) as a last resort effort if your device’s manufactur­er is being really stubborn.

Fastboot to freedom

Let’s quickly say again, before we get into the meat of proceeding­s, that we’re basing this guide on putting LineageOS onto an HTC One M7; your device may require fewer steps, or it may be vastly more complex. And there are risks; see the ‘Watch out’ box ( overthepag­e) to mitigate these.

First, we need to get the device into a nice vulnerable state – which means activating Fastboot mode. Fastboot is a protocol used to write data directly to your phone’s flash memory, which is exactly where our custom firmware is going to reside. Things aren’t quite as simple as that, of course, but let’s reboot your smartphone into the relevant mode by typing adb reboot bootloader into a terminal. Once this is done – and it should be pretty obvious from your phone’s display, which will show you a bunch of cryptic informatio­n about the specific versions of specific things running on it, and say, somewhere, ‘Fastboot USB’. Now check that Linux can still see the phone by typing fastboot devices into a terminal. Depending on your setup, this might have to be done as a superuser; if so, instead run: cd ~/platform-tools sudo ./fastboot devices

Unlocking

One thing you’ll probably notice about your device’s screen is the word ‘locked’. The vast majority of devices lock down their bootloader­s – the code that runs when the device is first switched on – for obvious reasons; most manufactur­ers would rather the average user didn’t cause them technical support issues or warranty disputes by installing their own custom ROMs. But by the same count, many manufactur­ers are happy to let developers do their own thing. Now that we’re accessing fastboot, we can obtain our device’s unlock token: fastboot oem get_identifier_token

In our case, it’s now off to the HTCDev website to register as a developer, followed by a visit to http://htcdev.com/ bootloader to turn that token into a key. There’s a fairly hefty warning shown on the site before we go through the process, as this really is the last chance to back out before your device is forcibly factory reset. Run through the instructio­ns, copy your unlock token from the terminal and paste it in the appropriat­e box, trimming off the ‘(bootloader)’ or ‘INFO’ text to make it one clean block and leaving the start and end identifier­s intact. If all has gone well, you’ll be sent your device unlock key to your registered email address. Save this to the ~/platform-tools directory, where your fastboot tool is located, then head back to your Terminal, move to the ~/platform-tools directory, and enter the following (switching the filename, if your device’s manufactur­er has sent you something different) to begin the unlock: sudo ./fastboot flash unlocktoke­n Unlock_code.bin

You’ll see yet another disclaimer, this time on your device’s screen. This really is your last chance to back out, as your

device will likely factory reset once you make the appropriat­e selection. Once this is complete head back to Settings and enable developer mode and USB debugging as before.

Recovery mode

Now that we’ve opened up access to your bootloader, it’s time to trick your hardware into thinking something has gone disastrous­ly wrong – a phone in recovery mode is one that’s all too willing to accept a new, presumably working, firmware

First, return to your device’s bootloader by typing adb reboot bootloader and verify that its fastboot is now unlocked. Now point your web browser at http://twrp.me, and get the relevant version for your device. TWRP is a custom recovery package that overrides the one that comes preinstall­ed with your smartphone or tablet, which is essential as default recovery systems are usually locked to official firmware images. Copy the file to your ~/platform-tools directory, open up your terminal in that directory, and then enter the following, switching the filename for that of your device: sudo ./fastboot flash recovery twrp-3.1.1-0-m7.img

You now need to reboot your device and enter its recovery mode manually. On our test phone, we do this by holding the power and volume down buttons on boot; your method might be different. You’ll see a screen very similar to the fastboot screen we’ve booted to previously; use the buttons stated on screen to select the ‘Recovery’ option, and, once TWRP is loaded, use the ‘swipe to allow modificati­ons’ slider.

Firmware flashing

With TWRP active, check with adb devices that your computer can see your device – it should be listed in ‘recovery’ mode. Get the appropriat­e build of LineageOS for your phone or tablet from http://download.lineageos.org and download the Google apps (called gapps) package from http://opengapps.org that matches your device’s architectu­re the version of LineageOS you’re installing, and the amount of apps you want to install; pick ‘nano’ if you just want the essential elements, or Stock if you want the entire selection of apps that comes with the Nexus and Pixel lines. There are in-between options, too; click ‘variant’ at the top of the right column to see a comparison table.

Installing Google apps is optional, and we’ll detail a completely open source alternativ­e shortly, but you may find your Android experience quite limited without the likes of the GooglePlay store on board. It’s worth noting that OpenGApps hosts its files on terrible servers, so you may need a little bit of time and perseveran­ce to get them downloaded; we employed liberal use of wget -c to resume downloads that failed. Place the files in your ~/platform-tools directory, and upload them to your device: adb push lineage<filename>.zip /sdcard/ adb push open_gapps<filename>.zip /sdcard/

Note that we’re uploading them to the /sdcard/ directory on your device; this will be present even if it doesn’t have a physical SD card slot, due to a quirk of Android’s file layout. Essentiall­y, /sdcard/ is code for ‘internal storage’; if you find that the adb push process doesn’t work (and it’s known to fail on certain devices) you may just be able to copy the files using your desktop file manager, particular­ly if it’s found and mounted your hardware as a drive.

Back on your device, you can now take a backup of your internal storage as it is in its current state if you wish. This is handy if you ever want to return to stock firmware, as some manufactur­ers don’t readily supply it. When you’re happy to install head to the Wipe menu and select Advanced Wipe. Check the relevant boxes and slide the slider to completely clear your Cache, Data and System partitions, then go back to the main menu and select Install. Scroll through your internal storage, select the LineageOS zip file, and swipe the slider to flash your firmware. Be patient during this stage; it may look as if nothing is happening, but interrupti­ng the process could mean your hardware ends up toast.

Now, before rebooting your system, repeat the same process with the Google apps file if you’re using it. This has a slightly more lucid installer, so you’ll see each app being installed as it goes on.

Gaining root

Don’t reboot quite yet. Advanced users may relish the chance to gain root access to their system. This isn’t supplied by

default with LineageOS, as it has obvious security implicatio­ns – install a rogue app with root access, and you stand to have your device seriously compromise­d. It also isn’t something everyone will need, but your hardware’s potential definitely increases slightly with it active. You can download LineageOS’ superuser tool from http://

download.lineageos.org/extras. Just grab the version that matches your OS, upload it to your phone as before, and flash it using TWRP’s install tool; it’ll take longer than you might expect for such a small file, but there are a lot of permission­s to change on the device.

If you later decide to unroot your device, you’ll find the relevant tool in the same place; just boot back into recovery, and flash it to unroot your device.

Starting up

It is, at last, time to reboot your device. You’ll be given the option to install the TWRP app on your system, which is entirely your decision; since you’re now using a device with custom firmware it can make working with recovery a little easier, so it’s not a bad idea.

Now follows a very lengthy initial boot process, during which LineageOS churns through your device’s storage making sure everything is set to go. Be patient, wait out the initial animation, and you’ll pop into the initial user setup process. This is very closely related to that of stock Android, and gives you the chance to restore data from another device if you wish. You’re also asked to sign in to Google services here; if you’re not using Google apps or the Google Play store, feel free to skip this.

When you’re through the Android part, you’ll get a little LineageOS-specific configurat­ion – we’d recommend switching on Privacy Guard, which is disabled by default, so you can control specifical­ly what data apps on your device are allowed to access. You can change your settings later in the Settings > Privacy menu, so if an app seems to be getting too big for its boots you can cut it down to size. Once that’s done, you’re in – with a clean, updated device, containing none of the manufactur­er’s original bloatware. If you didn’t install Google Apps, you’ll get a small stash of Lineage’s open source alternativ­es to ensure your phone hardware maintains its required functional­ity.

Extra options

If you’ve installed the root package, you’ll now need to enable it. Head to the Settings app, and tap the Build number seven times as we did before to enable developer mode. Go back to the main settings screen, and enter the developer mode menu. We’d recommend switching on Advanced Restart at this point – this lets you quickly boot to recovery or your bootloader using the standard restart procedure – then scroll down to the root access option and choose the level of access you’re willing to grant. ADB will restrict it only to commands send through Android Developer Bridge, meaning you can gain root access (and a root shell) on your device, but deny applicatio­ns the same rights.

There’s a lot more in the developer options than you’ll have previously seen in stock Android. You can really drill down to specifics, and enact some harsh policies over your hardware. Activating the ‘Don’t keep activities’ option, for example, is perfect if you want to take a more paranoid hold of your apps, and switching on ‘Enable local terminal’ adds a new app that gives you shell access to your device as long as you’ve previously given root access to apps.

 ??  ?? A recovery – like TWRP – accepts properlyco­nstructed zip files, and executes install scripts within when you come to put the software onto your device.
A recovery – like TWRP – accepts properlyco­nstructed zip files, and executes install scripts within when you come to put the software onto your device.
 ??  ?? You’re usually forced to control your device’s fastboot screen using the power and volume buttons, since it won’t load any touchscree­n drivers.
You’re usually forced to control your device’s fastboot screen using the power and volume buttons, since it won’t load any touchscree­n drivers.
 ??  ??
 ??  ?? If you run a terminal which allows corner-to-corner text selection, cutting out your device unlock token – obtained with fastboot oem get_identifier_token – is trivial.
If you run a terminal which allows corner-to-corner text selection, cutting out your device unlock token – obtained with fastboot oem get_identifier_token – is trivial.
 ??  ?? If you use Lineage’s superuser tool, consider removing it once you’ve done your privileged tasks – the removal tool is available from the same location.
If you use Lineage’s superuser tool, consider removing it once you’ve done your privileged tasks – the removal tool is available from the same location.
 ??  ?? Not sure which Google apps to put on your new phone? Download the ‘Aroma’ variant, which offers an interactiv­e installer to allow you to select them one-by-one.
Not sure which Google apps to put on your new phone? Download the ‘Aroma’ variant, which offers an interactiv­e installer to allow you to select them one-by-one.

Newspapers in English

Newspapers from Australia