Migrate from LineageOS for microG to LineageOS with microG

I’ve decided to migrate my phones OS from LineageOS for microG to LineageOS with microG and I’ve documented my process of doing this.

Why use LineageOS

I’ve ran LineageOS back when it was called Cynogenmod on my OnePlusOne and I’ve stuck to it ever since on my Android phones. I liked how it was a clean consistent Android OS which was well supported across many phones meaning if my device broke and was beyond economical repair I can get a new supported device and enjoy the same experience that I had before. It also prolongs the life of my phones as the majority of phones will get 2 to 3 years OS updates from manufacturers whereas LineageOS is still providing updates for my previous phone, a Xiaomi Pocophone F1 which was released in 2018. This allows me to run a system with the latest android securirty patches and reduces the creation of unnessecary e-waste.

Why use microG

It may be no great surprise to anyone how much information Google collects on any given person but people may overlook how much data the Google Play services collect on you. I can’t tell you exactly how much they collect or what they collect because it is not open source. That is a problem in its own right as I can’t audit what the Play Services are collecting on me. Sadly using Android without the Play Services whilst not impossible is a less desirable experience. A lot of developers utilise a lot of the Google Play API’s in their apps which will mean that some apps will either malfunction or not behave as designed when Google Play services are not installed. This is where microG enters the arena. It bridges the gap between usability and open. Google may still get some metrics whilst using microG but its just enough to ensure that the various apps I want to use now work. Its not perfect but a pragmatic compromise.

Why did I use LineageOS for microG

The official LineageOS team took a stance that they would not allow signature spoofing. This was required by microG to pretend to be the Google Play Services so apps called its reimplemented API’s. This was largely driven by security concerns which is somewhat fair however with this being a nessecity for microG an unofficial fork was created and the LineageOS for microG custom ROM was born. This ROM was LineageOS with MicroG built in and was arguably the easiest way for me to get both LineageOS and microG in one convenient package.

Why migrate away from LineageOS for microG

LineageOS/android_frameworks_base change 383574 has now allowed the microG to signature spoof. This has made LineageOS for microG custom rom redundant. Whilst they’ve not stopped releases immediately I am predicting in the near future they may do this.

Other than speculation there are a couple of minor benefits to moving back to the official LineageOS release, most notably frequent updates. For my device there is a weekly release for the official LineageOS custom ROM. As a result of this I will get security fixes and any other changes quicker than LineageOS for microG custom ROM which was a monthly release.

How am I migrating

Inconveniently its not as simple as installing the official LineageOS release over LineageOS for MicroG so the plan is as follows:

  1. Take a full nandroid backup just incase it goes horribly wrong and I need to revert
  2. Backup all applications and their data
  3. Install latest phone firmware
  4. Install LineageOS Recovery
  5. Install LineageOS
  6. Restore all applications and their data
  7. Install microG

Prerequisite

adb and fastboot needs to be installed on the computer. On a Debian based system this is as simple as running the following command in the terminal.

sudo apt install adb fastboot

Take full nandriod

To do this I will be using OrangeFox recovery. I followed this guide to get OrangeFox recovery installed.

Once booted into OrangeFox recovery I then took a backup of boot, data & super partitions. This should hopefully be enough for me to abort and revert if nessecary.

Once this has done I took a copy of the Fox directory from the phone onto the computer.

Backup all applications and their data.

To do this we are utilising the built in backup functionality in LineageOS which is seedvault. This is not a perfect solution as we’re depending on app makers to implement backups the Android standard way. As a result of doing this I am expecting to lose my Whatsapp chat history. I could backup to Google Drive if I really was that precious over the chat history but there is nothing that I need to keep there and I was not willing to backup to Google Drive.

To turn on seedvault backups I did this in Settings > System > Backup > Seedvault Backup

Once I completed my backup I took a copy of the .SeedVaultAndroidBackup directory onto the computer.

Install latest phone firmware

As I have been running LineageOS for quite a while there is a possibility that my phone firmware is out of date. On Xiaomi phones these usually get delivered as part of the MIUI update. Fortunately the kind folks at Xiaomi Firmware Updater provide flashable firmware meaning you do not need to install MIUI to get firmware updates. Firmware updates can bring driver fixes and security updates to your device so there is value to doing this periodically. Now seems a perfect time given we’re doing a full system refresh.

To do this I downloaded the latest firmware from Xiaomi Firmware Updater. I then rebooted my device into recovery. Once in recovery I went to Apply Update > Apply from ADB

Once ADB is enabled I should be able to run this command from the directory where I downloaded the firmware from inside my terminal:

adb sideload fw_alioth_miui_ALIOTHEEAGlobal_V14.0.11.0.TKHEUXM_067e9d6f67_13.0.zip

A popup on the phone will say Signiture verification Failed install anyway? I selected yes here. This is due to the flashable firmware not being signed by the LineageOS Team.

Install LineageOS Recovery and LineageOS

To avoid reinventing the wheel the folks over at LineageOS have a very good guide on how to install LineageOS for the Xiaomi Poco F3 on their website.

If you’re coming from a custom rom before some of these steps are not nessecary such as unlocking bootloaders. It is worth noting at this point I will be resetting the phone to factory settings so be sure to take a copy of anything important as data will be lost beyond this point.

Once those steps are complete I rebooted the device and follow the wizard to setup the device for the first time.

Restoring applications and data

As a result of resetting the phone I need to copy our backup onto the phone. To do this I copied the .SeedVaultAndroidBackup from the computer back onto the phone. Once thats completed open the phone dialer and type *#*#7378673#*#*. This will open up the seedvault restore process.

I was plesantly surprised at what a good job seedvault did at restoring my apps. Only a couple had issues being restored. One being F-Droid and the others being microG components. Both will be installed in due course.

The rest of my restore was internal storage items such as photos etc which I was able to move onto the device via the file explorer on my computer.

Install microG

The final piece of the jigsaw. To install microG I need to install F-Droid from the projects homepage. Once this is done I can go to settings in F-droid and add the microG repository which can be found on the microG project website. Once I’ve added this I then installed microG Service, microG Service Framework Proxy & microG companion from the F-droid repository. Once completed I rebooted the phone as I patched some key system components. Once rebooted I navigate to microG setting and select self check. I saw a lot of unchecked boxes so click on them to give microG the nessecary permissions to function. Once this has been completed I have done the minimum to get get microG running.

Optional tasks that would be worth doing

If you’re following along with what I did and this is your first time running microG you may want to consider these extra tasks:

Conclusion

This was a relatively uneventful OS swap. All worked fairly seamlessly with the exception of losing Whatsapp chat history which could have been avoided if I was willing to back it up to Google Drive. A successful change which will help to prolong the life of my Xiaomi Poco F3. The device has proven to be good value for money up to this point and I will probably stick with it for the foreseeable especially when the current phone market is not offering me much more than what I’ve got.