Skip to content

This chapter is geared towards advanced users. Solid tech skills are required.

LineageOS — The most popular custom mobile OS

LineageOS for microG

Compatibility

If you don't own a Pixel phone, LineageOS for microG might be a suitable Android mobile operating system for you. Make sure your exact handset model is featured in LineageOS's device list.

Before switching to LineageOS, keep in mind that while almost everything works just fine, some apps don't play nice. Including a few apps from Google, such as Android Wear, Google Fit, Google Cast or Android Auto. Fortunately, there are great FOSS alternatives available. Finally, mind that using paid apps without Google's Play Store can be a little tricky.


LineageOS backup

Backup

All data will be erased from your device during the installation process. Don't take any chances, back up your phone!


LineageOS debugging

USB Debugging

USB debugging needs to be enabled to allow the Android Debug Bridge (ADB) to connect your phone to the computer. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Open Settings ► System ► About phone.
2 Tap seven times on Build number to enable developer options.
3 Go back, and select the Developer options menu.
4 Scroll down, and check the Android debugging or USB debugging boxes.
5 Plug your Android device into the Windows computer.
6 Change the USB mode to file transfer (MTP).

On your Windows computer

Steps Description
1 Download ADB for Windows.
2 Extract the content of the .zip file.
3 Open the Windows Explorer and browse to the folder containing the extracted ADB files.
4 Right click within this folder and select the entry Open command window here or Open PowerShell window here.
5 Run the following command to launch the ADB daemon:
adb devices
6 A dialog should pop up on your Android phone, asking you to allow USB debugging. Check the box Always allow, and click on OK.

USB debugging needs to be enabled to allow the Android Debug Bridge (ADB) to connect your phone to the computer. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Open Settings ► System ► About phone.
2 Tap seven times on Build number to enable developer options.
3 Go back, and select the Developer options menu.
4 Scroll down, and check the Android debugging or USB debugging boxes.
5 Plug your Android device into the macOS device.
6 Change the USB mode to file transfer (MTP).

On your macOS device

Steps Description
1 Download ADB for macOS.
2 Extract the content of the .zip file.
3 Open the terminal and browse to the folder containing the extracted ADB files.
4 Run the following command to launch the ADB daemon:
adb devices
5 A dialog should pop up on your Android phone, asking you to allow USB debugging. Check the box Always allow, and click on OK.

USB debugging needs to be enabled to allow the Android Debug Bridge (ADB) to connect your phone to the computer. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Open Settings ► System ► About phone.
2 Tap seven times on Build number to enable developer options.
3 Go back, and select the Developer options menu.
4 Scroll down, and check the Android debugging or USB debugging boxes.
5 Plug your Android device into the Linux (Ubuntu) device.
6 Change the USB mode to file transfer (MTP).

On your Linux (Ubuntu) device

Steps Description
1 Open the terminal with the shortcut CTRL + ALT + T, or click on the Applications button on the top left and search for Terminal.
2 Run the following commands to update your system packages:
sudo apt update
sudo apt upgrade
3 Run the following commands to install ADB Fastboot:
sudo apt install android-tools-adb
sudo apt install android-tools-fastboot
4 Run the following command to start the ADB server (if it hasn't autostarted yet):
sudo adb start-server
5 Run the following command to launch the ADB daemon:
adb devices
6 A dialog should pop up on your Android phone, asking you to allow USB debugging. Check the box Always allow, and click on OK.


LineageOS bootloader

Unlocked Bootloader

Caution! Here be dragons.

Unlocking the bootloader will erase all data on your phone. If not already the case, back up your phone! Also, unlocking the bootloader will void your phone's warranty and lower it's security. An attacker with physical access could potentially install software without decrypting the phone, such as a password logger. Assess this potential security risk in light of your threat model.

The bootloader is the first piece of code that executes when powering on a phone. Many manufacturers lock the bootloader to avoid any modification to the phone. In order to install LineageOS for microG, the bootloader needs to be unlocked. This is the trickiest part, as the process differs from phone to phone, and requires a little bit of research:


LineageOS TWRP

Custom Recovery

Android phones come with a recovery software provided by Google, also called stock recovery. It's used to restore factory settings or update the operating system. To be able to install LineageOS for microG, this stock recovery needs to be replaced with a custom recovery.

The Team Win Recovery Project (TWRP) is a popular custom recovery. Beyond enabling the installation of LineageOS for microG, TWRP also allows to create backups and change system settings. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Plug your Android device into the Windows computer.
2 Change the USB mode to file transfer (MTP).

On your Windows machine

Steps Description
1 Browse to the TWRP website, select the correct phone model and download the appropriate TWRP version. For the purpose of this tutorial, let's assume the file has been downloaded to /Downloads/twrp-x.x.x.img.
2 Open the Windows Explorer and browse to the folder containing the downloaded .img file.
3 Right click within this folder and select the entry Open command window here or Open PowerShell window here.
4 Run the following command to reboot the phone into bootloader mode:
adb reboot bootloader

Alternatively, reboot the phone into bootloader mode by powering it off, and then holding down both Volume DOWN and POWER buttons. Release them once the word FASTBOOT appears on the screen. The combination of buttons might change from device to device. More information here.
5 Run the following command to make sure the computer can detect your phone:
fastboot devices
6 The terminal should prompt something similar to this:
$ 0077fxe89p12 fastboot
7 Run the following commands to navigate to the folder containing the custom recovery file (adjust accordingly) and flash the custom recovery to your phone:
cd /Downloads
fastboot flash recovery twrp-x.x.x.img
8 The terminal should prompt something similar to this:
$ sending ‘recovery’ (8450 KB)…
$ OKAY [ 0.730s]
$ writing ‘recovery’…
$ OKAY [ 0.528s]
$ finished. total time: 1.258s
9 Run the following command to boot directly into TWRP:
fastboot boot recovery twrp-x.x.x.img

The Team Win Recovery Project (TWRP) is a popular custom recovery. Beyond enabling the installation of LineageOS for microG, TWRP also allows to create backups and change system settings. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Plug your Android device into the Windows computer.
2 Change the USB mode to file transfer (MTP).

On your macOS device

Steps Description
1 Browse to the TWRP website, select the correct phone model and download the appropriate TWRP version. For the purpose of this tutorial, let's assume the file has been downloaded to /Downloads/twrp-x.x.x.img.
2 Open the terminal.
3 Run the following command to reboot the phone into bootloader mode:
adb reboot bootloader

Alternatively, reboot the phone into bootloader mode by powering it off, and then holding down both Volume DOWN and POWER buttons. Release them once the word FASTBOOT appears on the screen. The combination of buttons might change from device to device. More information here.
4 Run the following command to make sure the computer can detect your phone:
sudo fastboot devices
5 The terminal should prompt something similar to this:
$ 0077fxe89p12 fastboot
6 Run the following commands to navigate to the folder containing the custom recovery file (adjust accordingly) and flash the custom recovery to your phone:
cd /Downloads
sudo fastboot flash recovery twrp-x.x.x.img
7 The terminal should prompt something similar to this:
$ sending ‘recovery’ (8450 KB)…
$ OKAY [ 0.730s]
$ writing ‘recovery’…
$ OKAY [ 0.528s]
$ finished. total time: 1.258s
8 Run the following command to boot directly into TWRP:
sudo fastboot boot recovery twrp-x.x.x.img

The Team Win Recovery Project (TWRP) is a popular custom recovery. Beyond enabling the installation of LineageOS for microG, TWRP also allows to create backups and change system settings. More detailed instructions below.

Show me the step-by-step instructions

On your Android phone

Steps Description
1 Plug your Android device into the Windows computer.
2 Change the USB mode to file transfer (MTP).

On your Linux (Ubuntu) machine

Steps Description
1 Browse to the TWRP website, select the correct phone model and download the appropriate TWRP version. For the purpose of this tutorial, let's assume the file has been downloaded to /home/gofoss/Downloads/twrp-x.x.x.img.
2 Open the terminal with the shortcut CTRL + ALT + T, or click on the Applications button on the top left and search for Terminal.
3 Run the following command to reboot the phone into bootloader mode:
adb reboot bootloader

Alternatively, reboot the phone into bootloader mode by powering it off, and then holding down both Volume DOWN and POWER buttons. Release them once the word FASTBOOT appears on the screen. The combination of buttons might change from device to device. More information here.
4 Run the following command to make sure the computer can detect your phone:
sudo fastboot devices
5 The terminal should prompt something similar to this:
$ 0077fxe89p12 fastboot
6 Run the following commands to navigate to the folder containing the custom recovery file (adjust accordingly) and flash the custom recovery to your phone:
cd /home/gofoss/Downloads
sudo fastboot flash recovery twrp-x.x.x.img
7 The terminal should prompt something similar to this:
$ sending ‘recovery’ (8450 KB)…
$ OKAY [ 0.730s]
$ writing ‘recovery’…
$ OKAY [ 0.528s]
$ finished. total time: 1.258s
8 Run the following command to boot directly into TWRP:
sudo fastboot boot recovery twrp-x.x.x.img


LineageOS installation

Installation

Once the phone successfully booted into recovery (TWRP), LineageOS for microG can be installed. More detailed instructions below.

Show me the step-by-step instructions

On your Windows machine

Steps Description
1 Find out which codename is associated with your phone model on the LineageOS website. For example, the Fairphone's codename is "FP2", the Nexus 5X is called "bullhead", the Samsung Galaxy S9 is called "starlte", and so on.
2 Look for the same codename on the LineageOS for microG website. Click on the corresponding folder and download the latest version of LineageOS for microG. For the purpose of this tutorial, let's assume it has been downloaded to the location /Downloads/lineage-XX.X-202XXXXX-microG-CODENAME.zip.
3 Open the Windows Explorer and browse to the folder containing the downloaded .zip file.
4 Right click within this folder and select the entry Open command window here or Open PowerShell window here.
5 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 TWRP custom recovery should now load. Swipe the slider to enter the main screen.
2 Tap the Wipe button and then the Format Data button. Caution! This will remove encryption and delete all files stored in the internal storage. Make sure you backed up your data!
3 Return to the previous menu, tap the Wipe button and this time tap the Advanced Wipe button.
4 Select Cache, System and Data and swipe the slider Swipe to Wipe at the bottom of the screen.

On your Windows machine

Steps Description
1 To make sure the computer can detect your phone, type the following terminal command:
fastboot devices
2 The terminal should prompt something similar to this:

$ 0077fxe89p12 fastboot
3 Run the following commands to navigate to the folder containing the LineageOS for microG file (adjust accordingly) and copy the ..zip file to the internal storage of your phone:
cd /Downloads
adb push lineage-XX.X-202XXXXX-microG-CODENAME.zip /sdcard/

Alternatively, copy the .zip file manually from your computer to your phone, using the file manager.
4 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 Navigate to TWRP's main screen and tap on the Install button. Choose the LineageOS file lineage-XX.X-202XXXXX-microG-CODENAME.zip.
2 Swipe the slide Swipe to confirm Flash, wait until LineageOS for microG is installed and reboot the phone (this time, a "normal" reboot, not a "bootloader" or "recovery" reboot).
3 The first start can take a while. Congrats, LineageOS for microG is installed on your phone!

Once the phone successfully booted into recovery (TWRP), LineageOS for microG can be installed. More detailed instructions below.

Show me the step-by-step instructions

On your macOS machine

Steps Description
1 Find out which codename is associated with your phone model on the LineageOS website. For example, the Fairphone's codename is "FP2", the Nexus 5X is called "bullhead", the Samsung Galaxy S9 is called "starlte", and so on.
2 Look for the same codename on the LineageOS for microG website. Click on the corresponding folder and download the latest version of LineageOS for microG. For the purpose of this tutorial, let's assume it has been downloaded to the location /Downloads/lineage-XX.X-202XXXXX-microG-CODENAME.zip.
3 Open the terminal.
4 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 TWRP custom recovery should now load. Swipe the slider to enter the main screen.
2 Tap the Wipe button and then the Format Data button. Caution! This will remove encryption and delete all files stored in the internal storage. Make sure you backed up your data!
3 Return to the previous menu, tap the Wipe button and this time tap the Advanced Wipe button.
4 Select Cache, System and Data and swipe the slider Swipe to Wipe at the bottom of the screen.

On your macOS machine

Steps Description
1 To make sure the computer can detect your phone, type the following terminal command:
sudo fastboot devices
2 The terminal should prompt something similar to this:
$ 0077fxe89p12 fastboot
3 Run the following commands to navigate to the folder containing the LineageOS for microG file (adjust accordingly) and copy the .zip file to the internal storage of your phone:
cd /Downloads
sudo adb push lineage-XX.X-202XXXXX-microG-CODENAME.zip /sdcard/

Alternatively, copy the .zip file manually from your computer to your phone, using the file manager.
4 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 Navigate to TWRP's main screen and tap on the Install button. Choose the LineageOS file lineage-XX.X-202XXXXX-microG-CODENAME.zip.
2 Swipe the slide Swipe to confirm Flash, wait until LineageOS for microG is installed and reboot the phone (this time, a "normal" reboot, not a "bootloader" or "recovery" reboot).
3 The first start can take a while. Congrats, LineageOS for microG is installed on your phone!

Once the phone successfully booted into recovery (TWRP), LineageOS for microG can be installed. More detailed instructions below.

Show me the step-by-step instructions

On your Linux (Ubuntu) machine

Steps Description
1 Find out which codename is associated with your phone model on the LineageOS website. For example, the Fairphone's codename is "FP2", the Nexus 5X is called "bullhead", the Samsung Galaxy S9 is called "starlte", and so on.
2 Look for the same codename on the LineageOS for microG website. Click on the corresponding folder and download the latest version of LineageOS for microG. For the purpose of this tutorial, let's assume it has been downloaded to the location /home/gofoss/Downloads/lineage-XX.X-202XXXXX-microG-CODENAME.zip.
3 Open the terminal with the shortcut CTRL + ALT + T, or click on the Applications button on the top left and search for Terminal.
4 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 TWRP custom recovery should now load. Swipe the slider to enter the main screen.
2 Tap the Wipe button and then the Format Data button. Caution! This will remove encryption and delete all files stored in the internal storage. Make sure you backed up your data!
3 Return to the previous menu, tap the Wipe button and this time tap the Advanced Wipe button.
4 Select Cache, System and Data and swipe the slider Swipe to Wipe at the bottom of the screen.

On your Linux (Ubuntu) machine

Steps Description
1 To make sure the computer can detect your phone, type the following terminal command:
sudo fastboot devices
2 The terminal should prompt something similar to this:
$ 0077fxe89p12 fastboot
3 Run the following commands to navigate to the folder containing the LineageOS for microG file (adjust accordingly) and copy the .zip file to the internal storage of your phone:
cd /home/gofoss/Downloads
sudo adb push lineage-XX.X-202XXXXX-microG-CODENAME.zip /sdcard/

Alternatively, copy the .zip file manually from your computer to your phone, using the file manager.
4 Run the following command to reboot the phone into recovery mode:
adb reboot recovery

Alternatively, reboot the phone into recovery mode by powering it off, then holding down both Volume UP and POWER buttons. Release them once the logo appears on the screen. The combination of buttons might change from device to device. More information here.

On your Android phone

Steps Description
1 Navigate to TWRP's main screen and tap on the Install button. Choose the LineageOS file lineage-XX.X-202XXXXX-microG-CODENAME.zip.
2 Swipe the slide Swipe to confirm Flash, wait until LineageOS for microG is installed and reboot the phone (this time, a "normal" reboot, not a "bootloader" or "recovery" reboot).
3 The first start can take a while. Congrats, LineageOS for microG is installed on your phone!


LineageOS microG

microG

LineageOS for microG obviously ships with... microG. It's an open source replacement for Google's Play Services, which allows you to use features like push notifications or location without continually uploading your data to Google's servers.

To tell your phone to establish its location based on a local database with cell tower information and be completely independent from third party providers, follow the instructions detailed below.

Show me the step-by-step instructions

Steps Description
1 Open F-droid and install an app called Local GSM location.
2 Head over to the microG settings app. Navigate to Location modules and enable GSM Location Service as well as Nominatim.
3 Navigate to Self-Check and verify whether everything is set up properly.

LineageOS for microG avoids using Google's services as much as possible. There's one exception: many apps rely on Google Cloud Messaging (GCM), a proprietary system developed by Google, to push notifications to your device. microG can provide access to push notifications by enabling (limited) use of the GCM service. More details below.

Show me the step-by-step instructions

Steps Description
1 Open the microG settings app.
2 Navigate to Google device registration and register your device.
3 Navigate to Google Cloud Messaging and activate push notifications.

How can I trust CalyxOS if it uses Google Cloud Messaging?

Registering your device and enabling push notifications is optional. Doing so might provide limited data to Google, such as a unique ID. microG however makes sure to strip away as much identifying bits as possible. Activating push notifications can also enable Google to (partly) read the content of your notifications, depending on how apps use Google Cloud Messaging.

F-Droid is an app store exclusively hosting free and open-source applications, as develop in a previous chapter on FOSS apps. Make sure to enable microG's repository in F-Droid, as detailed below.

Show me the step-by-step instructions

Steps Description
1 Launch F-Droid.
2 Navigate to Settings ► Repositories.
3 Enable the microG repository.

Installing paid apps without Google's Play Store can be a little tricky. Here a workaround:

Show me the step-by-step instructions

Steps Description
1 Browse to Google's online play store.
2 Buy apps with an old or disposable Google account.
3 Log into Aurora store with the same Google credentials.
4 Download the purchased apps.


LineageOS support

Support

For further details or questions, refer to LineageOS's documentation or ask LineageOS's community for help.


LineageOS