Follow these instructions at your own risk.
Mostly open source operating system
For privacy and security, no Google account/login is required
Apps from the Google Play Store are available for use
System root available for any apps that require it (such as ad blockers)
Uses the privacy-respecting microG substitute for the Google Services Framework (required by many apps on the Play Store)
Software updates beyond Google’s end-of-life (May 2022—see When you’ll get Android updates on Google Support)
Obviously this page targets the Google Pixel 3a, but of course there are a variety of variants falling under this designation.
Model G020G, the “North America” model
The phone is bootloader unlockable. This is an absolute requirement: locked bootloaders prevent the installation of custom software on a phone. Generally, Pixel devices purchased from Google are bootloader unlockable whereas devices purchased from carriers are not, but this is not universally true.
The phone is SIM unlocked—not necessary for installing LineageOS, but I recommend only purchasing SIM unlocked phones so the device’s network compatibility is not artificially limited.
For more information about the Pixel 3a, see the Pixel 3a Wikipedia page.
A computer with the Android adb and fastboot utilities is required. On Debian 11 Bullseye, these can be installed by running apt install adb fastboot as root.
A USB port and a USB-C cable are also necessary.
Also download the LineageOS for microG files before starting—see Install LineageOS for microG, below.
Unlock the bootloader
Unlocking the bootloader will erase all the data on the phone.
To unlock the bootloader:
Navigate to Settings > About phone and tap Build number multiple times until developer options are enabled.
Navigate to Settings > Developer options and enable both OEM unlocking and USB debugging.
Connect the phone to your computer and run adb reboot bootloader. The phone may ask whether to Allow USB debugging?—tap Allow. Run the command again if it times out while requesting permission. The phone should now be in Fastboot Mode.
Check that the device is visible in fastboot mode by running fastboot devices. The device should be listed. Then run fastboot flashing unlock to unlock the bootloader. Use the volume keys on the phone to select Unlock the bootloader and then press the power button to confirm.
Once the phone has finished resetting, press the power button (Start) to boot the phone again.
Update the stock firmware
It may theoretically be possible for Google to remove the ability to unlock the bootloader in a stock firmware update. However with this phone we are dependent on portions of the firmware released by Google and we must assume that a bootloader-unlockable phone will remain bootloader-unlockable. Also, the bootloader was already unlocked in the previous step.
Before beginning the process of setting up LineageOS for microG, the stock firmware should be updated. This is necessary because LineageOS cannot maintain and distribute all of the phone’s firmware, such as the modem firmware, but LineageOS does expect that firmware to be current (as published by Google—see Google’s Factory Images for Nexus and Pixel Devices).
To update the stock firmware, navigate on the phone to Settings > System > Advanced > System update. Repeatedly check for, install, and apply updates until there are no more updates available.
Install LineageOS for microG
Download the recovery image and installation package. See the LineageOS for microG sargo downloads listing. You need the latest *.zip and *.img files. I used these:
$ sha256sum * ccaac2391eeb4fddb7c045b18c814b9a9c50135e70e9c9fa9073b7f3f0d84d47 lineage-18.1-20210411-microG-sargo-recovery.img 005f6eb4549e782ed6e1a47f529bc4eab19098fb77c9abdd9803a589ce3d2294 lineage-18.1-20210411-microG-sargo.zip
Enable USB debugging again as described in Unlock the bootloader (steps 1 and 2).
Connect the phone to your computer and run adb reboot bootloader. Again the phone may ask whether to Allow USB debugging?—tap Allow. Run the command again if it times out while requesting permission. The phone should now be in Fastboot Mode.
Flash Lineage Recovery on the phone by running fastboot flash boot lineage-18.1-20210411-microG-sargo-recovery.img (for example).
Use the volume keys to select Recovery Mode and press the power button to confirm. The phone should boot into Lineage Recovery with a menu.
Tap Factory reset and Format data/factory reset and finally confirm by tapping Format data. You can ignore any can't send spi message errors in the output. Once the format is complete, return to the main menu by tapping the back arrow.
“Sideload” the installation package by tapping Apply update and Apply from ADB. The phone will wait to receive the package. On the computer, run adb sideload lineage-18.1-20210411-microG-sargo.zip (for example) to send the file to the phone. When this is finished, go back to the main menu, navigate to Advanced, and tap Reboot to recovery.
Magisk installation requires extracting, modifying, and flashing the boot image. See also the official Magisk Installation instructions.
From recovery, navigate to Advanced and select Enable ADB.
Note the Active slot shown near the top of the display. On the computer, run the following, using the boot_a or boot_b corresponding to the current active slot:
$ adb shell dd if=/dev/block/bootdevice/by-name/boot_X of=/sdcard/boot.img 131072+0 records in 131072+0 records out 67108864 bytes (64 M) copied, 0.455638 s, 140 M/s $ adb pull /sdcard/boot.img $ adb rm /sdcard/boot.img $ adb reboot
Download the latest Magisk APK to the computer. The file is available on the Magisk Releases page on GitHub.
Complete the LineageOS for microG first-boot setup on the phone.
Enable USB debugging again as described in Unlock the bootloader (steps 1 and 2).
Transfer the Magisk APK and boot.img files to the phone:
$ adb push boot.img /sdcard/ $ adb push Magisk-v23.0.apk /sdcard/
Install the Magisk app by opening Files and tapping on this file.
Open the Magisk app, tap Install, tap Select and Patch a File, navigate to the files root (Pixel 3a), and tap the boot.img file. Then tap LET’S GO.
Note the output file path shown. Pull this file to the computer by running adb pull /storage/emulated/0/Download/magisk_patched-23000_Tdjbi.img (for example).
Now flash this image to install Magisk. On the computer:
$ adb reboot bootloader $ fastboot flash boot magisk_patched-23000_9ksfr.img target reported max download size of 268435456 bytes sending 'boot_a' (65536 KB)... OKAY [ 1.630s] writing 'boot_a'... OKAY [ 0.333s] finished. total time: 1.963s $ fastboot reboot rebooting...
In this case, we are using Magisk to provide superuser/root access for apps that require it. Magisk will prompt you when an app requests root access. Apps with permission are listed in the Magisk app, accessed from the shield button at the bottom.
Magisk can also install modules to modify system partitions during the boot process. The modules are accessed from the puzzle piece button at the bottom of the Magisk app. There are no modules that need to be installed for the purposes of this document.
Magisk module failures can cause Android boot failures. I recommend using only the modules listed here unless you have reason to try others. If you do have trouble with modules, see Disabling/uninstalling modules manually in the Magisk Installation and Troubleshooting Guide on didgeridoohan.com.
Open the F-Droid app, navigate to Settings > Repositories, and enable the Guardian Project repository.
In Settings, navigate to System > Advanced > Developer options. Disable USB debugging; you can enable it again later if necessary. Enable Local terminal for local shell access—look for Terminal in the app list and type su to get root access there if necessary.
In Settings, navigate to System > Advanced > microG Settings > Location modules and enable both. If asked for permission, set it to Allow all the time by following the instructions given.
Some GSF-dependent apps use Google’s Cloud Messaging (GCM) service to register for “push” notifications. Without cloud messaging, an app may that depends on it not receive messages promptly. Cloud messaging can be enabled in microG Settings: first enable Google device registration and then enable Cloud Messaging. If you have an app that you think uses cloud messaging but microG Cloud Messaging status shows On - 0 registered Apps, then try the following.
Disable Cloud Messaging and then disable Google device registration. Reboot the phone.
Enable Google device registration and reboot the phone.
Enable Cloud Messaging and reboot the phone.
See orestarod’s post on Reddit for some other things to try if that does not work.
Adaway, available on F-Droid, can be set up to block ads system-wide. Choose Root based ad blocking.
The Aurora Store app, available on F-Droid, allows you to browse and install apps from the Google Play Store. Choose the Root installer method. You do not need to have/use a Google account; just select the Anonymous login. Because you do not want Aurora Store to replace microG with the standard Google Play services app from the Play Store, be sure to blacklist the com.google.android.gms app: tap Updates tab at the bottom, long tap the Google Play services app, and tap Add to Blacklist (in the Blacklist Manager, the app will be labeled as microG Services Core). Aurora Store will indicate when an app “requires GSF” (the Google Services Framework); these services are being provided by microG instead.
The Signal app, available on the Play Store via Aurora Store, provides end-to-end encrypted messaging and calling on Android and iOS. Signal Desktop is also available for Linux, macOS, and Windows. Note that Signal uses your mobile phone number as your ID, so unfortunately a phone and phone number are required. (Perhaps at some point Jami will be able to replace Signal with a more robust decentralized messaging system.) If you have cloud messaging enabled but Signal has not registered, trigger a new attempt: in Signal, navigate to Settings > Privacy > Advanced, and disable and enable Signal messages and calls (you will have to receive an SMS message to re-register, so make sure you are able to receive an SMS message when you do this).
To prolong battery life, consider using the Advanced Charging Controller (ACC) Magisk module to set charge thresholds. AccA, available on F-Droid, can also provide an interface for adjusting ACC settings (install the module and reboot first). For more information about improving battery life, see Battery University’s BU-808: How to Prolong Lithium-based Batteries.
System updates provided by the Lineage for microG project can be installed via the regular mechanism at Settings > System > Advanced > Updater.
Note that while the Magisk app and any installed Magisk modules will remain, Magisk features will not work until Magisk has been reinstalled to the boot partition. See the Install Magisk section. It is not necessary to download and install the Magisk app APK unless there is a newer version available than the one currently installed.
2021-09-05: Add the Updates section
2021-09-05: Delete the extracted boot.img when installing Magisk
2021-06-22: Simplify steps for setting up cloud messaging
2021-06-22: Add Signal instructions for re-registering cloud messaging
2021-06-22: Blacklist the microG app in Aurora Store
2021-06-21: Unlock the bootloader first, then update stock firmware
2021-06-10: Add more details about setting up cloud messaging