I tried to follow the installation instruction in the first post but ended up in bootloop. So I though I would make a detailled guide for new users since some instructions are not all in the same place.
I wanted to backup at least the EFS partition. More on partitions and what they do.
Starting point : Moto G5 "cedric" with stock Oreo latest security update (december 2018).
- Set up ADB on your PC, plenty of guides out there.
- Optionnal : backup your current configuration using adb. Useful adb guide.
- Download the special version of TWRP (64bit) as linked in the first post. Regular TWRP, as of now, is only 32bit and may not decrypt your data partition.
- Download the latest ROM as described in first post
- Download latest Magisk on the official thread.. Mine was 19.1
- Download the dm-verity disabler
- Unlock bootloader like described here, this will reset your smarphone to factory setting
Copy the downloads on your Phone/SDcard.
- Set up a pin number on your phone. Without it TWRP will not be able to decrypt your data partition.
- Activate USB debugging on the phone.
- In a terminal on your PC and with the phone on and connected with usb, make it reboot in bootloader mode : "adb reboot bootloader"
- Flash the TWRP recovery : "fastboot flash recovery twrpxxxxx.img"
- From the bootloader screen, use the volume up/down to select "recovery mode" and presh the power button, this will boot TWRP. It will ask for you PIN set up earlier to decrypt the data partition.
- Go to backup, choose a storage, I only had internal.
- Backup all partions that make sense to you (EFS for me). If you chose SDcard for storage, turn off the phone, remove the card and copy the backup to your PC and skip to step 12. If you selected internal storage, carry on.
- Boot your phone. Since we did nothing to prevent the dm-verity from working, this will reset your recovery.
- Copy your backup from internal storage to your PC
- Go back to bootloader mode as in step 3
- Reflash TWRP
- from TWRP, go to wipe then advanced, then Format. This will erase everything.
swipe to wipe "Data/Cache/Dalvik".
- Go back and tap "Advanced". Wipe "System".
- Copy the file your downloaded earlier on your phone using "adb push"
- Go back and install the ROM, Magisk and the dm-verity zip. Magisk will give you root.
- Reboot and enjoy !
EDIT : Reworked because I kept having to enter my PIN number on boot and I had a GPS icon showing even when locations were turned off. bold text is new instructions. I striked the old ones.