Replacing Android with LineageOS

Tabula Rasa

Anyone installing a system of a different type, be it a change from the default Android to Lineage or a newer LineageOS version, now needs to trigger a factory reset (Wipe in TWRP, the Factory Reset, is preselected (Figure 7)). All the installed apps are lost but not the data, such as music files or photos. It goes without saying that a backup of this data is recommended, in addition to the system backup with TWRP.

Figure 7: The TWRP Wipe menu item performs a factory reset after dragging the slider – almost always the only reset operation you need, as the program itself correctly notes.

The Titanium Backup [7] smartphone program gives you an option for backing up the installed apps, including settings before wiping, but it requires the device to be rooted up front (Figure 8). In principle, you can use this option to transfer apps purchased in the Play Store to a smartphone without using Google's services because Titanium saves the associated APK installation packages, which can then simply be copied. In practice, the apps usually check whether they are running on a device registered to the buyer and refuse to work or cannot be installed at all. The MicroG framework [8], an open source replica of Google's services, promises a remedy.

Figure 8: The Titanium Backup app backs up all installed apps, including their settings, on rooted devices and quickly restores them after a factory reset.

The MicroG services also need to contact the Google server for license management but will conceal your personal data, according to their developers. Their location services work offline, for example. Most apps start without problems in the environment, but some do not [9].

Although MicroG continuously transmits the device IP to Google, many users might be more trusting of an open source app – for example, when it says that it does not read and transmit the GPS coordinates if the location services are disabled. If you insist on a completely Google-free smartphone, you have no choice but to restrict yourself to the alternative F-Droid app store (Figure 9). There are far fewer apps available there but still around 4,500.

Figure 9: Many authors of free Android software exclusively publish their apps in the alternative F-Droid store, or they use F-Droid in addition to the Google Play Store.

MicroG cannot be post-installed on LineageOS because it has to spoof signatures to Google – LineageOS does not allow that at the system level. However, there is the LineageOS fork LineageOS for MicroG [10], which integrates MicroG into an otherwise unmodified LineageOS system. /e/OS [11] goes a bit further, with its own app store and many free apps from the Play Store.


After running the backup function, the next step is flashing. Click the Install button in the main menu to get the flashing started. This step installs the ZIP images [2] of the LineageOS distribution. You just need to tap on an archive file in the file manager on the Install screen.

In the next screen, the software offers you the option of flashing additional ZIP archives onto the new system (Add more Zips), for example, a root extension for LineageOS or the Google Play Store (see box entitled "LineageOS Add-Ons"). You can launch the actual flash process by dragging the Swipe to confirm Flash slider to the right.

LineageOS Add-Ons

Many power users root their system, as rooting is the only way to adblock, control cells with a tool such as Tasker [12], or tune the kernel settings for better performance and improved power consumption. However, current LineageOS releases no longer offer the option to root via a checkbox in the developer options. Instead, the project recommends installing Magisk [13]. Rename the downloaded Magisk-VERSION.apk file to, and TWRP's Install function will recognize it as an installation image that you select with Add more Zips before flashing the main system. On a rooted system, install the original Magisk-v2x.x.apk package, which refreshes the app without launching the rescue system.

LineageOS does not ship Google Play Store or other company services and apps by default. If you want to use the Play Store or paid apps, you need to install OpenGApps [14] before starting the new system for the first time. Apps are also available as ZIP files, which you can add to the flash process in TWRP by selecting Add more Zips. On the OpenGApps page, select the correct variant based on three properties: the processor platform (see the LineageOS wiki page for your device: Architecture), the Android version (also in the LineageOS wiki), and the Variant, that is, the content scope of the OpenGApps package. The stock option sets up the full scope installed on Nexus phones. The nano option includes all items not available through the Play Store and is recommended for users who want to build their own systems.

Quickly Served Up

Sideloading lets you you transfer files directly from your computer without requiring you to manually copy the files on the SD card. (TWRP still needs enough storage space for the image on the SD card.) Sideloading also lets you install several ZIPs one after another.

For a sideload, with the smartphone connected to the PC and the TWRP system running, first call adb devices to check if the mobile device can be accessed. The adb tool is in the android-tools-adb (Ubuntu) or android-tools package. The adb call should return a line with a device identifier, followed by Recovery. Select Advanced | ADB Sideload on the TWRP homescreen and drag the appropriate slider to the right.

On the PC, run adb sideload IMAGE. Again, the percentage value displayed on the PC console is not very meaningful; it often remains at 0% for a long time. In our lab, the transfer even supposedly aborted at 49 percent, but TWRP reported a complete installation and the new system booted flawlessly.

Now you have a clean Android system without bloatware, either with or without Google App Store, and with the resource-saving Trebuchet homescreen app (Figure 10), which is perfect for many users. You can select the home app in the Android settings below Apps and Notifications | Default Apps | Start App.

Figure 10: Trebuchet, the default homescreen app on LineageOS, combines good configurability with acceptable resource consumption.

The Android web browser, a calendar, a picture viewer and camera app, a telephony app, email, a text message app, a simple audio player, a voice recorder, a calculator, and a file manager are pre-installed.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Open Hardware – eelo

    With the eelo project, Gaël Duval has big plans for a free-licensed phone, with an accompanying app store and online services.

  • Linux Android Backup

    Linux Android Backup offers an open source solution to backing up the most important content from your Android devices in just a few steps.

  • PostmarketOS

    The mobile Linux distribution PostmarketOS is a fork of Alpine Linux that supports around a dozen user interfaces.

  • Linux Apps on Android with UserLAnd

    UserLAnd lets you run Linux applications on your Android phone – all without replacing Android OS.

  • FOSSPicks

    This month Graham looks at Bespoke, Waydroid, OpenShot, pedalboard, Onivim 2, Mr. Rescue, and more!

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More