[Moto G8 Plus Questions & Answers] waltermobile:
step-by-step guide of how to install LineageOS on Moto G8 Plus

[update]

Since I keep improving this manual with feedback from other users, I added a changelog at the end

So here is my step-by-step guide of how to install LineageOS (and potentially other custom roms) on a Moto G8 Plus device. This instruction is loosely based on the sources mentioned in the text. On my Moto G8 Plus LOS that I flashed with the steps from below guide, everything is working except Bluetooth Audio (still not have found a soulution) and one Authenticator app for my Health Insurance won't run because it claims that I my device is not secure (other banking apps and authenticators work fine, though).

Before you follow the steps below, be aware that even though this worked on my phone, it does not necessarily have to work on your device. There are different versions of this phone on the market (e.g. I have the XT2019-1 and there is also an XT-2019-2). On the site with the lineage download link listed below, there is a detailed description of how to identify the parameters of your device. User comcloudway apparently seriously bricked his phone after following my guide, so before you start, please be aware of the risks when flashing a custom rom. Personally, I have some experience (successfully flashed LOS on 5 different devices in the past years), but certainly I am not an expert. What I did in the guide below is copy together different bits of information i found on other sites + some extra tweaks I figured out myself by trial and error.

This obviously can only work once you OEM-unlocked your phone, which will void your warranty. Note that all your data will be wiped so be sure to have a backup of all personal data on your phone. If you decide to follow the steps below, you do this on your own risk. I recommend to read the full instruction as well as all following posts before you follow the individual steps.

When I first tried to install Lineage on Moto G8 Plus, I ended up in a boot loop and had to flash the all files from the stock rom individually to get back to stock, as suggested by Couchraver (I never had to lock and unlock my bootloader, though). I assume that my below instructions work with a working stock rom. If they do not or if you are in a boot loop but still have access to your bootloader, you might consider to flash the individual stock rom files (I will describe how to do this at the end of this post).

If you run this guide, PLEASE share your feedback, also if you were able to successfully flash LOS!

Before you start, you should check that you have working bootloaders on both slots. Apparently, this can be done by the following script, which I have not tested yet. Note that this process can potentially jeopardize your phone itself by changing the active boot slot:

adb reboot bootloader

fastboot getvar current-slot # AND WRITE DOWN ITS VALUE

fastboot --set-active=a

fastboot reboot bootloader

fastboot getvar current-slot # YOU NEED TO SEE "a"

fastboot --set-active=b

fastboot reboot bootloader

fastboot getvar current-slot # YOU NEED TO SEE "b"

#### IF EVERYTHING IS OK

fastboot --set-active={value you wrote before}

fastboot reboot

(source: https://forum.fairphone.com/t/how-to-flash-a-custom-rom-on-fp3-with-gsi/57074/74)

Before I started, I installed latest adb+fastboot installed and latest Motorola drivers on my Windows PC.

Then, I downloaded

TWRP and TWRP installer using the links from this site: https://xdaforums.com/moto-g8-plus/development/recovery-unofficial-twrp-recovery-moto-t4059137

empty vbmeta file that you can either create yourself or download. E.g. I found the following download link https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img on this site https://www.xda-developers.com/how-...-gsis-on-samsung-galaxy-devices-without-twrp/

the Lineage image file using the link on this site (search for the green download links box): https://www.getdroidtips.com/lineage-os-17-1-moto-g8-plus/ (Note that on the actual download site, there are different versions of the Lineage image file. For me, the correct file was the ‘arm64_bvN’ file (first in the list), although the ‘arm64_avN’ file had far more downloads. As [MENTION=11015307]barbarossa2020[/MENTION] pointed out, according to Andy Yan's description (on his sourceforge download page) the bvN version should be used whenever there are two slots (AB). (thanks to [MENTION=11015307]barbarossa2020[/MENTION] for the hint).

openGapps (ARM64, Android 10, pico) from here: https://opengapps.org/

latest magisk version using the links from this site: https://www.getdroidtips.com/download-latest-magisk-zip-magisk-manager-root-phone/

I then copied the twrp-3.4.0-0-doha-mauronofrio.img file to the adb folder on my PC and copied the following files to my micro SD that I then inserted to my moto G8 Plus:

twrp-3.4.0-0-doha-installer-mauronofrio.zip

lineage-17.1-20200713-UNOFFICIAL-treble_arm64_bvN.img (I extracted the .img file from the .xz file using 7-Zip)

Magisk-v20.4.zip

Ensure that the files that are copied to the micro SD card are copied correctly (e.g. using md5sum check afterwards). E.g. [MENTION=11015307]barbarossa2020[/MENTION] followed this guide and noticed to get corrupt files on the SD card several times after copying or unplugging the SD card from the computer. This resulted in strange error messages when trying to flash with TWRP (thanks to [MENTION=11015307]barbarossa2020[/MENTION] for highlighting this).

Once you put the sd card back to your Moto G8 Plus and connected the device via USB to your PC, perform the follwoing steps:

Boot to stock rom, enable developer options and then in developer options enable USB-Debugging (you should have done this when unlocking the device, however this might get set back after having flashed stock).

Power off the phone and boot to bootloader with power+vol down.

In adb, I type fastboot boot twrp-3.4.0-0-doha-mauronofrio.img (modify the filename if you have a newer version in your adb folder)

In TWRP, click ‘Reboot’ and check what the current slot is. In my case it is Slot A. I think this determines which Lineage file you need to flash. As described above, for ‘Current Slot: A’, only the ‘arm64_bvN’ file was working for me.

At this point you might consider to make a backup of your stock rom (in TWRP) and store it to your SD.

Also, at this point you should install the TWRP installer from the SD card and then restart TWRP (reboot to recovery). Make sure to install the actual installer zip file (e.g. twrp-3.4.0-0-doha-installer-mauronofrio.zip) and not the img file that you booted from fastboot.

boot to bootloader and flash empty vbmeta file (download link above) using command "fastboot flash vbmeta vbmeta.img"

Go back to main TWRP menu, click ‘Wipe’, then ‘Advanced Wipe’ and wipe 'System' and 'Data' but NOT ‘MicroSD’ (we need the files copied to the SD card) and NOT ‘Vendor’. It is crucial to wipe ‘System’ and ‘Data’, but NOT to wipe the ‘Vendor’ image!

Go back to the TWRP main menu and click ‘Install’. Click ‘Select Storage’ and select your SD Card. Click ‘Install Image’ button on the bottom right. Select the Lineage image file saved to your SD card and flash as ‘System Image’. (in my case lineage-17.1-20200713-UNOFFICIAL-treble_arm64_bvN.img)

Before I flashed empty vbmeta file, I only got LOS to work when insalling magisk. If you flashed empty vbmeta file, you should only need to install magisk if you want to actually root your phone. To do so, go back to the TWRP main menu and again click ‘Install’ to install the ‘Magisk-v20.4.zip’ file.

If you want to use open Gapps, you should install it now. Note that for me to be able to install GApps Pico, I had to first resize the File System (under ‘advanced wipe’, select ‘System’ and click ‘Resize File System’ button without actually wiping ‘System’), as described in this post:

https://xdaforums.com/android/help/fix-error-70-install-gapps-t3311779

If you have installed magisk and want to remove it, I noticed this works best with the file UPDATE-unSU-signed-30-march-2018.zip. Right now can't find the site that linked to this file, might update later.

User SnowTalker recommended to 'flash copy Partitions', however I do not know what exactly this means.

I hope this helps.

If you should end up in a boot loop, I would download a stock rom zip and try to flash the individual stock rom files from that zip to your phone using fastboot. Note that the below description worked on my device, but does not necessarily work on your device!

In my case, I downloaded the latest stock rom zip from this site:

https://www.getdroidtips.com/moto-g8-plus-firmware/

I unzipped the content of the downloaded file

XT2019-1_DOHA_RETEU_9.0_PPIS29.65-51-3_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

to my adb/fastboot folder.

Note that the above file was the latest version at the time I had to flash stock rom. If you perform these steps at any point in time, I would recommend to download the latest stock rom version.

I then connected the device to my PC via USB, booted to Bootloader (Power+Vol Down) and copy-pasted the following string of commands to my adb folder cmd window. Note that I did not write these commands myself but rather copied them from the internet (unfortunately I lost the source from where I copied the commands, otherwise I would quote it here). They are not specific to any particular stock rom file and in fact will include references to files that do not acutally exist in your stock rom file. E.g. the script below counts up to img_sparsechunk.12, although there are only less files with this counter in the stock rom file. I assume this is a precautionary measure in case future stock rom files have a higher counter. In my experience data rows with references to files that do not exist are just ignored. I added a 'pause' command at the end of the script because on my PC i have to manually execute the last command when I copy paste mulitple command lines, so the pause is to ensure that the reboot is automatically executed.

fastboot getvar max-sparse-size

fastboot oem fb_mode_set

fastboot flash partition gpt.bin

fastboot flash bootloader bootloader.img

fastboot flash modem NON-HLOS.bin

fastboot flash fsg fsg.mbn

fastboot flash bluetooth BTFM.bin

fastboot flash dsp dspso.bin

fastboot flash logo logo.bin

fastboot flash boot boot.img

fastboot flash system system.img_sparsechunk.0

fastboot flash system system.img_sparsechunk.1

fastboot flash system system.img_sparsechunk.2

fastboot flash system system.img_sparsechunk.3

fastboot flash system system.img_sparsechunk.4

fastboot flash system system.img_sparsechunk.5

fastboot flash system system.img_sparsechunk.6

fastboot flash system system.img_sparsechunk.7

fastboot flash system system.img_sparsechunk.8

fastboot flash system system.img_sparsechunk.9

fastboot flash system system.img_sparsechunk.10

fastboot flash system system.img_sparsechunk.11

fastboot flash system system.img_sparsechunk.12

fastboot flash system_b system_other.img

fastboot flash oem oem.img

fastboot flash oem_b oem_other.img

fastboot flash system_b.img_sparsechunk.0

fastboot flash system_b.img_sparsechunk.1

fastboot flash system_b.img_sparsechunk.2

fastboot flash system_b.img_sparsechunk.3

fastboot flash system_b.img_sparsechunk.4

fastboot flash vendor vendor.img

fastboot flash vbmeta vbmeta.img

fastboot erase carrier

fastboot erase userdata

fastboot erase DDR

fastboot oem fb_mode_clear

fastboot reboot

pause

Changelog

3 Aug 2020

added recommendation to check if you have working bootloaders on both slots before you start flashing image.

changed instruction to flash TWRP and not install Lineage from a temporarily booted TPWRP

I deleted the instruction to wipe all partitions except vendor. Instead, only wipe system + data.

deleted statement that it is imparative to install magisk in order to get LineageOS to work on the Moto G8 Plus. Instead, I added recommendation to flash empty vbmeta file.

4 Aug 2020

corrected instruction so that 'Data' and not 'Vendor' needs to be wiped

added sme more information in the instruction text for the restore stock rom script

removed rows 'fastboot erase modemst1' and 'fastboot erase modemst2' from the recover stock rom script,because these steps might unrecoverably delete device specific data such as the IMEI (thanks to [MENTION=10518525]xdixa[/MENTION] for highlighting this)

17 Aug 2020

added [MENTION=11015307]barbarossa2020[/MENTION] hint to check files copied to SD card for corruption

added [MENTION=11015307]barbarossa2020[/MENTION] hint how to select correct image file

Thanks to [MENTION=10894995]SnowTalker[/MENTION], [MENTION=10518525]xdixa[/MENTION] and [MENTION=11015307]barbarossa2020[/MENTION] for helping to improve this guide