[Moto G5 Guides, News, & Discussion] G5-User7080:
Hello guys,

after testing around for days i thought it might be helpfull to post the honestly pretty easy procedure to install stock Oreo, root it and remove encryption if needed.

Disclaimer:

I am not responsible for bricked devices, dead SD-cards, lost data, etc.

Back up your data, app settings, be sure you remember your passwords, your device will be empty!​

Edit: It seems, theres a bug that, if you read this post on XDA labs, won't show you everything, it seems like it randomly skips some parts.

What you need:

Unlocked Bootloader

Motorola USB drivers

15 sec adb and fastboot uploaded by myself since the original links aren't working anymore https://multifilemirror.com/hgxxyrfyd7rx.

I originally got them from here (you may have to go into your device manager and select the adb drivers for your phone f.e. when you want to use adb push in recovery, see original xda site).

This will also install the google drivers.

TWRP 32bit (v.3.2.3-0)

TWRP 64bit (v.3.2.1-0)

Disable Dm-Verity & ForceEncrypt from here

Magisk and MagiskManager. Newest should probably work, i used Magisk-18.0 and MagiskManager-6.1.0

Most recent Oreo firmware (edit 08.19)

(I used this Oreo firmware found in this post)

Steps:

Be sure you backed up your data and app settings, your pictures, downloads, etc. It will all be lost!

Please read all steps before you begin.

Extract the firmware into your adb folder (where you installed adb, should contain 4 files), copy both twrp (32 & 64 bit) in there, too.

Boot into bootloader (hold power+vol down) and open a terminal inside your adb folder (shift+rightclick) and type in

fastboot flash recovery name_of_twrp64bit_file.img

Boot into recovery (select recovery with vol buttons, then press power) and make a backup of EFS partition and persist folder (use file manager under advanced) and make another backup of system, boot and data and save both backups and persist to your SD-card or better your computer, too.

reboot into bootloader and check if your bootloader version is B.8.31 or above.

If it is B.8.31 or above DON'T FLASH BOOTLOADER!!! Because if you flash bootloader of the same version or below, it would hardbrick your device!

That also means if you f.e. want to downgrade to Nougat, just ignore following lines:

fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img

Also, unless youre sure your persist is absolutly ok (check here), please also omit the following lines:

fastboot erase modemst1
fastboot erase modemst2

They would reset your IMEI and usually it gets restored from your persist, but only if its not buggy.

Even if your persist is fine, as far as i know theres no harm in not using this commands (my persist is fine and i didnt use them).

Now paste following commands in your command promt in adb, in case you are BELOW B.8.31, add the bootloader commands from above between the first and second line:

fastboot oem fb_mode_set
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.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 modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot reboot

Please make sure that it really flashed all sparsechunk 0-8.

Let your phone reboot itself after installation is done, then return to bootloader and flash twrp 64bit:

fastboot flash recovery name_of_twrp64bit_file.img

Boot into recovery, since your device is encrypted it will ask for a password, click cancel, then go to WIPE and click on FORMAT DATA and confirm with yes.

This will remove the encryption of your data partition.

Go back to twrp main page and click on REBOOT then RECOVERY.

Once back in twrp, either copy Disable Disable_Dm-Verity_ForceEncrypt.zip and Magisk-18.zip and MagiskManager-6.1.apk to your SD-card or use

adb push name_of_file /external_sd
or
adb push name_of_file /sdcard

to copy the files to your SD-card (external_sd) or Internal-Storage (sdcard). For this you may have to manually configure your adb drivers in device manager, see here under Notes.

In twrp go now to INSTALL and flash "disable-dm-verity&encrypt" an then REBOOT and SYSTEM.

Return to recovery and flash "Magisk-18.0.zip", wipe Cache/Dalvik at the end and reboot System

Once System has rebooted, install MagiskManager-6.1.0.apk from your SD-card.

MagiskManager should say that Magisk is installed and in settings under security, your phone should be decrypted.

Note: MagiskManager will only show full information when it has internet access, all you see without is if Magisk is installed.

If you want to encrypt your device again, do it but flash twrp 32bit, too, if it asks for a password, it should be your usual password which you also have to enter on every boot.

Some explanation:

Why twrp 64bit?

Because twrp 32bit is able to bypass encryption, however, it causes some problems:

In fact, probably every twrp without the bypass encryption feature would work f.e. older 32bit version 3.1.0. but 64bit offers some features as EFS backup.

If you flash 32bit directly it can bypass the standard encryption but formatting data fails every time when you booted System previously.

When you reboot recovery and format data again it works, but it needs to fail first, just rebooting into recovery 2 times doesnt work.

I dont know what would happen if you (after using your phone normally) reboot recovery and f.e. want to do a backup from data, though im sure i testet it out, but i probably forgot.

You need it later when you want to encrypt your phone again, for me it didnt decrypt data after i reencrypted my phone using my password.

Why reboot System between flashing Disable-encryption and Magisk?

If you do not, you get heavy lags in the first 2 minutes after rebooting System, MagiskManager will say that Magisk isnt installed and then your phone will crash and reboot. But after that 2. reboot everything works fine again, Magisk is back, no lags.

I remembered this post from Johny Cipeli, between flashing no-verity and magisk he wrote to reboot, so i tried and it worked without lags and crash.

You don't need to remove encryption:

You can root your phone without flashing Disable_dm-verity_and_force-encrypt, use then twrp 32bit, dont format data, just flash magisk.

I can say that it should work, because that was one of my first attempts (and it worked for me), however i didnt write down what i was doing so i cant tell you step by step.

Additional:

In case you're searching Viper4Arise for Oreo, the Aroma installer won't work, use the Magisk module and install in MagiskManager. You can download it here from Zackptg5

If youre also annoyed by that One-Nav vibration, you can try using ExKernelManager app and activate the powersave mode. Although i think its officially not for G5, the app works, maybe that only refers to the Kernel and not to the app.

I tried Flyhigh Kernel, it didnt boot after flashing it, if you know a working Kernel for G5 which can disable One-Nav vibration, please write an answer.

My device:

Rooted Stock Oreo 8.1.0: OPP28.85-16

Bootloader: B.8.31

Model: XT1676 reteu

Stock Kernel

Thanks to:

Snoop05 for 15 sec adb and fastboot.

TheFixItMan for twrp.

Zackptg5 for "Universal DM-Verity, ForceEncrypt, Disk Quota Disablers".

topjohnwu for Magisk.

freeZbies for Official Oreo 8.1.0 OPP28.85-16 Fastboot Firmware.

Wolfcity, woozie.2007 and TheFixItMan for answering many of my questions!