LineageOS = ❤ (a step by step guide)

🇺🇸 – Thursday, October, 10th 2019

Keywords: #LineageOS, #Cyanogen, #Android, #ROM, #AOSP

Protect your privacy, get rid of blobs with unknown-to-you behaviors, decrease the use of trackers, or keep your smartphone up-to-date to get security patches, or also postpone the replacing of your device by a newer one so as to be “greener”… there are plenty of reasons to move your smartphone from Android (stock)to LineageOS (born from the ashes of Cyanogen). Here you can find a small guide with steps to follow.

Of course, here are only the steps I follow for my 5-years-old OnePlus One. You have to be cautious with your device and the things you do on it. Some steps or files may differ from a version or device to another. I won’t be responsible of course if you break or “brick” your stuff (having a bootlooping smartphone is funny but that’s all). The steps are also compiled in this LineageOS dedicated page. More details are provided also in this wiki.

Moreover I did not try yet other altOS (alternative operating systems) like /e/, GrapheneOS or Replicant. Feel free to have a look on these projects!

You should keep in mind developers cannot do whatever they want about the apps they create and you use. In most of cases, making softwares working with “old” operating systems is always seen as a “massive cost” for chiefs and managers. Capitalism and mass market make things worse: tech giants are more focused on releasing new products than keeping the “old” up-to-date. So please, help and back free and open source projects and people who want to make things more sustainable.

Step 0: Get OS, Google apps (or not) & recovery

The first step consists on getting the binaries you have to flash (i.e. install) on your device.

➡️ One of these magic things is, of course, the operating system for your device. Go to the LineageOS download page and select your device model (for me, OnePlus One, a.k.a. “bacon”). In the selected page you may see a lot of “nightly” builds: these versions are created each night, so choosing the last is not the best idea (e.g. because of possible stability issues or unfixed bugs).

➡️️️ Another step is related to the Google applications you want to add to your device (or not). In fact in the Android ecosystem it is quite complicated to run an app, get updates or install things without any amount of Google apps (the “Gapps”). For example the Google Play Services are almost essential, and clean your device of them may prevent you to get some apps.

To choose the amount of “Google apps” you want, go to the OpenGapps project. Then choose the architecture of your device, the version of the Android OS embedded in your LineageOS ZIP and the variant. For example in my case, I can choose ARM, Android 9.0 and “pico”. In this case I have the bare minimum to get the Google Play functionality.

➡️ Another thing to download is a custom recovery. The recovery is a dedicated bootable partition with very few features like cleaning your data, change the file system or flash components. In fact it allows you to install on your device the LineageOS version you want. For instance you can choose a TWRP recovery from TeamWin. I got my file here.

➡️ Finally you should also download the Android SDK (i.e. “software development kit”). It brings a lot of tools you don’t have to care with, except adb and fastboot.This toolbox is really useful if you want to tinker with your toy. Have a look on this page to download the SDK (see the “Command line tools only” section).

Step 1: Unlock the developer mode

By default your device has its developer mode turned off. You have to enable it if you want to use adb and fastboot commands. So go to your settings, “about the phone” field, then tap many times on the “build” number. If you tapped enough, a message should warn you have enabled the mode. After this step, go back to the new “options for developers” menu which has appeared, and enable the USB debugging option. Finally, run the following command:

adb devices

It should display the list of attached devices, with the name in the right column (here for me “device” and on the left a word with digits and characters (like “2a926c99”)). Note that I use a Linux-powered computer… did I talk about privacy before? Things for macOS or Windows may be the same.

Step 2: Unlock the bootloader

The bootloader deals with the boot of your device (duh!) and loads the first programs to start. Depending to the device you use, it may be mandatory to unlock it. In fact some manufacturers lock them, so… change that. Unlocking your bootloader will allow you to change your recovery and change your OS. First, reboot your bootloader with:

adb reboot bootloader

Your device must restart in the fastboot mode, and display on the screen the “Fastboot mode” message. Note that adb and fastboot are available in the “platform-tools” folder of the SDK zip you got. Then unlock the bootloader with:

fastboot oem unlock

If it succeeded, it should display an “OKAY” message.Finally, install the recovery you got in Step 0, with:

fastboot boot RECOVERY_FILENAME.img

If it succeeded, it should display… another “OKAY” message :)

Step 3: Flash LineageOS and Gapps

The web site of LineageOS is clear enough, so you can follow their instructions (Installing LineageOS from recovery), I won’t make dumb copy/paste. They use here the sideload feature. The way I choose is using the memory of the device to store the ZIP files, and make the install from the recovery.

➡️ You have to boot your device in recovery mode and format the data of your device (caches, system and data for example). It will erase all files and data your device contains. The recovery mode can be triggered with a combination of pressed keys you have to press during several seconds until the device restart (for my bacon, it’s power + volume down buttons).
Then, upload in your device the ZIP of LineageOS and the ZIP for the Gapps you downloaded before in step 0. To do so, run:

adb push /sdcard

adb push /sdcard

Then, from the recovery options, go to the “install” menu and choose the ZIP files you uploaded (first the system, then the Gapps). If the flashes succeeded, the device will restart to the new operating system you just freshly installed!

Step 4: Customize your device!

Once you followed the install instructions, your device will be fully functional. You can now customize it. For example, download the alternative store F-Droid from the web browser. Go to their web site, install the APK file and run the app! If you install F-Droid following this way, a security warning occurs telling you the app is not trusted. You can enable the “unknown sources” option to install the app.Be aware with this option which can be a security flaw if untrusted apps are installed, so disable it after.

From F-Droid you can download the Yalp app. Yalp allows you to download an app without using Google Play nor Google account. Useful isn’t it?

You can also install from Yalp (or F-Droid which is really another store, not a proxy like Yalp) plenty of apps respectful for your privacy. The web browser Brave, which tries to create another model for advertisement more fair and clear, and also block trackers. The Exodus privacy app, which scans in their cloud a lot of Android apps looking for trackers ans flaws, and show you the results thanks to their app. Then Ooni Probe, which tells you if web sites, services or social networks are filtered or blocked in the network you use. Fight against censorship matters, and knowing if your network is spied may be useful. P-R-I-V-A-C-Y I said. If you like Fediverse and decentralized social networks, and have a Mastodon account, get the Tusky app ;–) Twidere is also cool and rich. You don’t want to remember of your passwords? Keepass2Android is a good option :) And what if you want to see videos? NewPipe is a facade for YouTube ;–) About messaging, why not use Silence or Signal! For your mails K-9 is efficient enough. If you are looking for a navigation app, try OsmAnd why uses Open Street Map layers. You can also use the Tor Browser app to surf quite anonymously! If you use 2FA authentication, why not use andOTP?

Finally, why not encipher your device? This option protect your data, messages, SMS et other valuable details from unwanted access. The process to encrypt take some minutes, but privacy and security matter ;–)

Some things to know…

You may encounter problems while flashing the recovery or the OS, or unlocking the bootloader. Sometimes with some devices you cannot unlock the bootloader.I had to make several attempts with different versions of Gapps and recovery to make my LineageOS booting and running.Once you succeeded in having a good configuration and a working device, make a backup of your files. Thus you will be always able to flash the components which worked in the past, it saved me a lot of time

Security, privacy, keep your things as long as possible… it can be tricky to do that but the result worth it!

Last update: Thursday, October, 10th 2019 Previously on Medium and

Did you enjoy reading this blog? Give me a beer 🍺 or use something else ❤️‍🔥 Licensed under CC-BY-SA 4.0 Opinions are my own, even if I have some interests. For any comment or to contact me, feel free to choose the most suitable medium for you.