• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] Moto G5 Plus: Flashing Stock Firmware & Rooting [2021]

Search This thread

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
Flashing signed stock firmware:

You need:

Latest signed stock firmware:
Europe (RETEU):
https://mirrors.lolinet.com/firmware/moto/potter/official/RETEU/

India (RETIN):
https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

US (RETUS):
https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

All other locations:
https://mirrors.lolinet.com/firmware/moto/potter/official/

Also:

flashallO.bat:
https://drive.google.com/file/d/1Ne7Kps25heUO7wsJ0Z4_X43eKQYRegoa/view?usp=sharing

Motorola drivers:
https://drive.google.com/file/d/0B0...=sharing&resourcekey=0-Ia2zj9jiuzpxpVp6-mfmmw

Tiny ADB & Fastboot v1.2.0 signed;
https://drive.google.com/file/d/1I15rjuORqmawiKUUMGSTx0R_fdXDVucH/view?usp=sharing


1) Download the 8.1.0_OPS28.85-17-6-2 firmware for your region (it's the last one for the Moto G5+ (potter), there won't be any updates anymore, so no risk of bootloader downgrading)

2) Install Tiny ADB & Fastboot (best place is the root directory of C: or wherever your OS resides).

3) Extract the firmware to that ADB & Fastboot folder.

4) Download my "flashallO.bat" and move it to that folder too.It removes the need for you to manually flash all partitions, just double-click it and it'll run all the commands for you.

5) Download and install Motorola device drivers.The program is called "Motorola Device Manager".

6) Reboot your phone to the bootloader. To do this, turn it off, then hold down the power and volume down buttons until you see a bugdroid undergoing open-heart surgery.
7) Connect the phone to your PC with your USB cable. Type
Code:
 fastboot devices
to check if your device is connected. A serial number should be shown.
8) Run the flashallO.bat script. (Caution: This will wipe your device completely!) It will take some time to flash, just be patient and don't worry.
If the command window appears for a brief moment and then disappears, the device drivers may not be installed correctly. You can ask me in that case, there are some special drivers that may solve that.
9) Once the command window closes, it should have completed the flashing process and you are safe to press the power key on the phone to start Android. Just make sure that the text near the buttons reads "START".

That's it.

You can save your (internal) data when you open the flashallO.bat and delete the command
Code:
fastboot erase userdata
so that it will be omitted.
I won't recommend it but it's possible.




Rooting:

You need:


Magisk 23:
https://github.com/topjohnwu/Magisk/releases/tag/v23.0
If you have problems with the new Magisk builds (since v22) because you own an older legacy device you may try
Magisk 20.4: https://github.com/topjohnwu/Magisk/releases/tag/v20.4

TWRP 3.5.2_9-0:
https://eu.dl.twrp.me/potter/twrp-3.5.2_9-0-potter.img

Maybe you'll need:
Disable_Dm-Verity_ForceEncrypt.zip:
https://yadi.sk/d/HLr5vjnkA8gaqw

- Download TWRP from the above link and place it in your ADB & Fastboot folder.
- Download magisk.zip (and Magisk Manager APK if you use version 20.4) and place it in your internal storage.
- Turn the phone off again and reboot to bootloader using previously mentioned key combination.
- Navigate to the folder where you placed the TWRP image.
- Hold down the "shift" key and right-click anywhere in the Explorer window,it should give you an option to "Open command window here."
- Now input the command: "fastboot flash recovery [filename].img", where [filename] is the name of your TWRP image file. Tap Enter and it will take a few seconds to flash the new recovery.
- Alternatively, you can use "fastboot boot [filename].img" to temporarily boot TWRP for the purpose of flashing Magisk. This retains the stock recovery.
- Now that TWRP has been flashed, press the volume down key until you see the label on the side change to read "RECOVERY." At that point you can press the power button and you will boot right into TWRP.

- If you decide to decrypt your device:
In that case go to "Wipe" in TWRP and use "format data" (the option where you have to confirm with "yes"). Just wipe data is not enough!
- If you want your device to stay encrypted skip that step.

- Now press the "Install' button in TWRP and navigate to the location where the magisk.zip is located. Simply tap it and "Swipe to install."

- If you decided to decrypt your device normally magisk should take care that it doesn't get encrypted again.
Magisk only disables the enforced encryption flag, the device will still be encrypted and that's why a wipe of data is necessary to remove the encryption.

If that's not the case and you get problems to reboot flash Disable_Dm-Verity_ForceEncrypt.zip after magisk.zip.

More information about decryption/encryption:
https://didgeridoohan.com/magisk/Magisk#hn_Disabling_dm-verity_and_forced_encryption

- Reboot your device, if the Magisk Manager isn't installed already (it should) install the Magisk Manager APK.



Thanks to @Jrhotrod for parts of the rooting tutorial.


Edit: Updated Links.
 
Last edited:

DwightKBrute

Member
Mar 2, 2017
11
1
My 3 year old Moto G5 Plus running android 8 suddenly restarted a few days ago and went into Start up failure. It no longer shows My product or IMEI number. It just shows potter 000000000000000 32GB P3B

Bootloader logs read " Start up failure. Your device didn't start up successfully. Use the Software Repair Assistant on computer to repair your device. Connect your device to your computer to get the Software Repair Assistant" written in red.

I have my IMEI and product numbers saved on my pc in a notepad file, but the LMSA software does not recognise my device to even try to rescue it. I want to retrieve files from my phone before attempting a factory reset.

On using the LMSA, it says "lmsa doesn't match appropriate firmware. you can try to select a firmware manually" but then it has no option to select anything manually. I have my phone previously registered on the software on my PC.

I have not rooted my phone, nor used anything other than stock android. My bootloader is locked. I cannot remember if I had Developer options selected or not, most probably not.

On trying to go to recovery mode it says the same message " Start up failure. Your device didn't start up successfully. Use the Software Repair Assistant on computer to repair your device. Connect your device to your computer to get the Software Repair Assistant"

When I connect the phone to the computer, it recognises it (I hear a notification sound) and under Devices it shows under Unrecognised as "Fastboot potter s"

I've never flashed my phone but would it be possible to recover the files in the internal storage of the phone by installing TWRP (in a non rooted, bootloader locked phone) without data loss?
How does it work?

Please help! I really need to recover my photos and notepad notes. Is there any way? Any software?

Is there any way to flash stock ROM without losing data? I haven't attempted anything in the off chance that there is a way to recover internal storage data. It's absolutely essential to me. I don't care about the phone, I'm gonna replace it anyway.

If I can even switch on the phone for long enough to backup data from the phone, it will be enough.

I read in another thread that downgrading a Moto with a locked bootloader will hard brick the device. This thread. My bootloader/oem is locked. I've attached a screenshot from when I once connected my phone to LMSA a few weeks before it crashed, it showed my current version I was running at the time. I never got around to taking a backup of the phone, then.

phone ss - Copy.png

These are the screens I get. I try to charge the phone in fastboot every day to keep it from dying completely.
IMG_20201215_195545545.jpg IMG_20201215_195534489.jpg

I'm desperate.
 

DwightKBrute

Member
Mar 2, 2017
11
1
Also Lolinet seems to be down. I tried to download RETIN firmware from the link you provided, but I only get
404 Not Found
nginx


What to do now?

I downloaded the firmware from Motorola Stock Room. Will that do?
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
I downloaded the firmware from Motorola Stock Room. Will that do?
[/QUOTE]
Also Lolinet seems to be down. I tried to download RETIN firmware from the link you provided, but I only get
404 Not Found
nginx


What to do now?

I downloaded the firmware from Motorola Stock Room. Will that do?
I also recognised that lolinet.mirrors has some problems but it seems it's been working on it (see attached screenshot).
The firmware from Motorola Stock ROM should work, it's the same build and also the last firmware for the Moto G5+ so no risk of bootloader downgrading.
Let me know if you were successful.

Screenshot_2020-12-20-13-21-42-843_com.android.chrome.jpg
Edit: No way to save your data from an unroofed device with locked bootloader, I'm sorry.
You can omit the "fastboot erase userdata" command (see above thread) to save your internal storage when flashing the firmware but as you have problems with your device a complete clean start may be the only solution. But you can give it a try.
 
Last edited:

DwightKBrute

Member
Mar 2, 2017
11
1
I downloaded the firmware from Motorola Stock Room. Will that do?

I also recognised that lolinet.mirrors has some problems but it seems it's been working on it (see attached screenshot).
The firmware from Motorola Stock ROM should work, it's the same build and also the last firmware for the Moto G5+ so no risk of bootloader downgrading.
Let me know if you were successful.

View attachment 5162915
[/QUOTE]


I will follow your instructions on this post.
The download from the Motorola stock room has adb, flashboot and everything else (including a .bat file) in its folder.

3.png


firmware.png


How can I use your .bat file (from the link you provided) instead of the one from Motorola Stock Room?

Also I want to preserve the internal storage, so I can erase the fastboot erase userdata command. But how do I open the .bat file? There is no open with option.

bat file.png
 
Last edited:

DwightKBrute

Member
Mar 2, 2017
11
1
Also since I'm missing my IMEI and SKU, should I keep the erase modemst1 and fastboot erase modemst2 commands in the file?
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
I also recognised that lolinet.mirrors has some problems but it seems it's been working on it (see attached screenshot).
The firmware from Motorola Stock ROM should work, it's the same build and also the last firmware for the Moto G5+ so no risk of bootloader downgrading.
Let me know if you were successful.

View attachment 5162915


I will follow your instructions on this post.
The download from the Motorola stock room has adb, flashboot and everything else (including a .bat file) in its folder.

View attachment 5162925

View attachment 5162923

How can I use your .bat file (from the link you provided) instead of the one from Motorola Stock Room?

Also I want to preserve the internal storage, so I can erase the fastboot erase userdata command. But how do I open the .bat file? There is no open with option.

View attachment 5162927
[/QUOTE]

Copy this content and put it into a notepad:


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 erase modemst1
fastboot erase modemst2
fastboot flash dsp adspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.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 oem oem.img
fastboot erase cache
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot


Delete the fastboot erase userdata line and save it as .bat file (if your notepad has no option to save it as .bat save it as .txt and change the ending from .txt to .bat by hand).

And deactivate your Windows Defender when doing that and also when using the .bat file.
 

DwightKBrute

Member
Mar 2, 2017
11
1
I will follow your instructions on this post.
The download from the Motorola stock room has adb, flashboot and everything else (including a .bat file) in its folder.

View attachment 5162925

View attachment 5162923

How can I use your .bat file (from the link you provided) instead of the one from Motorola Stock Room?

Also I want to preserve the internal storage, so I can erase the fastboot erase userdata command. But how do I open the .bat file? There is no open with option.

View attachment 5162927

Copy this content and put it into a notepad:


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 erase modemst1
fastboot erase modemst2
fastboot flash dsp adspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.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 oem oem.img
fastboot erase cache
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot


Delete the fastboot erase userdata line and save it as .bat file (if your notepad has no option to save it as .bat save it as .txt and change the ending from .txt to .bat by hand).

And deactivate your Windows Defender when doing that and also when using the .bat file.
[/QUOTE]


So let me just recheck the steps.

1. Downloaded the firmware from Motorola Stock Room
2. Downloaded and installed Mini Adb.
3. Extracted the firmware to the same folder as the mini adb
4. Deleted the .bat file already present in the extracted firmware folder from MSR. Replaced that with the .bat file you have provided.
5. Erase userdata command removed.
6. Run the .bat file.
7. Wait for flashing to complete

Yes?
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
I also recognised that lolinet.mirrors has some problems but it seems it's been working on it (see attached screenshot).
The firmware from Motorola Stock ROM should work, it's the same build and also the last firmware for the Moto G5+ so no risk of bootloader downgrading.
Let me know if you were successful.

View attachment 5162915


I will follow your instructions on this post.
The download from the Motorola stock room has adb, flashboot and everything else (including a .bat file) in its folder.

View attachment 5162925

View attachment 5162923

How can I use your .bat file (from the link you provided) instead of the one from Motorola Stock Room?

Also I want to preserve the internal storage, so I can erase the fastboot erase userdata command. But how do I open the .bat file? There is no open with option.

View attachment 5162927
[/QUOTE]
Download (or copy) my flashallO.bat file delete,the erase userdata line
Copy this content and put it into a notepad:


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 erase modemst1
fastboot erase modemst2
fastboot flash dsp adspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.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 oem oem.img
fastboot erase cache
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot


Delete the fastboot erase userdata line and save it as .bat file (if your notepad has no option to save it as .bat save it as .txt and change the ending from .txt to .bat by hand).

And deactivate your Windows Defender when doing that and also when using the .bat file.


So let me just recheck the steps.

1. Downloaded the firmware from Motorola Stock Room
2. Downloaded and installed Mini Adb.
3. Extracted the firmware to the same folder as the mini adb
4. Deleted the .bat file already present in the extracted firmware folder from MSR. Replaced that with the .bat file you have provided.
5. Erase userdata command removed.
6. Run the .bat file.
7. Wait for flashing to complete

Yes?
[/QUOTE]


Sounds ok. The bat file has to be copied into the ADB & Fastboot folder (mini ADB) too.
Deactivate Defender and start the bat file.
Be patient.
And collect as many data from the flashing process as possible (screenshots etc.)
 

DwightKBrute

Member
Mar 2, 2017
11
1
Well. I wasn't able to get many screenshots, it happened too quickly. But the phone is still stuck on fastboot, but this time the fastboot reason is given as: Last time flashing failed.

Oh well. I'll try again without removing the flashboot erase userdata?

failed to validate recovery image
 

Attachments

  • 12.png
    12.png
    108.5 KB · Views: 60

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
Well. I wasn't able to get many screenshots, it happened too quickly. But the phone is still stuck on fastboot, but this time the fastboot reason is given as: Last time flashing failed.

Oh well. I'll try again without removing the flashboot erase userdata?

failed to validate recovery image
Seems your device has problems to erase partitions before flashing new stuff to them. Maybe search for blankflash files.
 

DEJAVU54

Member
Jul 10, 2020
22
0
Hello. I have a rooted Moto G5 Plus (Magisk) and I have also installed a Custom ROM with TWRP. I want to unroot the device and return it to absolute stock. Will this guide work in that case? If no, can anyone direct me to the correct guide?
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,378
2,784
Germany
Moto G 2014
Moto G5 Plus
Hello. I have a rooted Moto G5 Plus (Magisk) and I have also installed a Custom ROM with TWRP. I want to unroot the device and return it to absolute stock. Will this guide work in that case? If no, can anyone direct me to the correct guide?
The above guide https://forum.xda-developers.com/t/guide-moto-g5-plus-flashing-stock-firmware-rooting-2021.4205293/ should be helpful for you. Flashing the latest signed stock firmware as described in the first part will take you to absolute stock.

A few points to take care of:

- Make sure that you chose the correct firmware for your location.
- Don´t delete the fastboot erase userdata command from the flashallO.bat so that it will be omitted because some parts of Magisk or other root apps may reside at that location.

- You have to erase everything to be on the safe side.
- So save your internal userdata like pictures, documents, music etc. to a PC or a SD card before you start the
process!
- Flashing stock will overwrite the recovery.img (TWRP) and the boot.img (Magisk) so you don´t have to unroot or reflash stock recovery.

If you want to relock your bootloader too (remember that you won´t get to the "nerver unlocked" state again, the device will flag the bootloader as "has been unlocked" even when you lock it):

-After flashing stock firmware open a command prompt in the ADB & Fastboot folder again and give the following commands one by one or use the attached relockO.bat file. the same way you did it with the flashallO.bat:

relockO.bat:

fastboot oem lock fastboot oem lock 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 boot boot.img fastboot oem lock

You can do that anytime, it hasn´t to be right after the firmware flash.
 
Last edited:
  • Like
Reactions: sd_shadow

DEJAVU54

Member
Jul 10, 2020
22
0
I flashed the ROM today and everything went well, except the IMEI is 0 and I cannot use VoLTE. What can I do?
 

DEJAVU54

Member
Jul 10, 2020
22
0
What does getvar all say?
post it here after you remove imei line.
Code:
fastboot getvar all
(bootloader) version: 0.5
(bootloader) version-bootloader: moto-msm8953-C0.92
(bootloader) product: potter
(bootloader) board: potter
(bootloader) secure: yes
(bootloader) hwrev: P3B
(bootloader) radio: 6
(bootloader) storage-type: emmc
(bootloader) emmc: 32GB SAMSUNG RX14MB RV=08 PV=07 FV=0000000000000007
(bootloader) ram: 4GB SAMSUNG LP3 DIE=8Gb M5=01 M6=05 M7=00 M8=5F
(bootloader) cpu: MSM8953
(bootloader) serialno: ZY2244FVLG
(bootloader) cid: 0x0032
(bootloader) channelid: 0xc0
(bootloader) uid: 10E5EE5600000000000000000000
(bootloader) securestate: flashing_unlocked
(bootloader) iswarrantyvoid: yes
(bootloader) max-download-size: 534773760
(bootloader) reason: Volume down key pressed
(bootloader) meid:
(bootloader) date: 05-23-2017
(bootloader) sku: XT1686
(bootloader) carrier_sku:
(bootloader) battid:
(bootloader) iccid:
(bootloader) cust_md5:
(bootloader) max-sparse-size: 268435456
(bootloader) current-time: "Thu Aug 30 2:39:28 UTC 1973"
(bootloader) ro.build.fingerprint[0]: motorola/potter_n/potter_n:8.1.0/O
(bootloader) ro.build.fingerprint[1]: PSS28.85-13-3/72e4:user/release-ke
(bootloader) ro.build.fingerprint[2]: ys
(bootloader) poweroffalarm: 0
(bootloader) ro.build.version.full[0]: Blur_Version.28.201.4.potter.reta
(bootloader) ro.build.version.full[1]: il.en.US
(bootloader) ro.build.version.qcom: LA.UM.6.6.r1-08600-89xx.0
(bootloader) version-baseband: M8953_41.50.07.82u POTTER_INDIADSDS_CUST
(bootloader) kernel.version[0]: Linux version 3.18.71-perf-g70fa69f (hud
(bootloader) kernel.version[1]: [email protected]) (gcc version 4.9.x 2015
(bootloader) kernel.version[2]: 0123 (prerelease) (GCC) ) #1 SMP PREEMPT
(bootloader) kernel.version[3]: Wed Oct 10 11:58:58 CDT 2018
(bootloader) sbl1.git: git=MBM-NG-VC0.92-0-gd009c3b
(bootloader) rpm.git: git=92e5e21-dirty
(bootloader) tz.git: git=26cc248-dirty
(bootloader) devcfg.git: git=26cc248-dirty
(bootloader) keymaster.git: git=26cc248-dirty
(bootloader) cmnlib.git: git=26cc248-dirty
(bootloader) cmnlib64.git: git=26cc248-dirty
(bootloader) prov.git: git=26cc248-dirty
(bootloader) aboot.git: git=MBM-NG-VC0.92-0-g3ea8df0
(bootloader) frp-state: no protection (0)
(bootloader) ro.carrier: retin
(bootloader) current-slot:
(bootloader) slot-suffixes: _a
(bootloader) slot-count: 1
(bootloader) slot-successful:_a: INVALID
(bootloader) slot-successful:_b: INVALID
(bootloader) slot-bootable:_a: INVALID
(bootloader) slot-bootable:_b: INVALID
(bootloader) slot-retry-count:_a: unknown
(bootloader) slot-retry-count:_b: unknown
all: listed above
Finished. Total time: 0.062s
 

DEJAVU54

Member
Jul 10, 2020
22
0
Have you ever flashed someone else's persist file?
No I have not. Only the PixelExp zip and now, the stock rom.
Anyways, after panicking a bit yesterday, I flashed the custom rom again and my IMEI and LTE returned, but I cannot place/receive calls. What can be done if I wanted to stay on the ROM but gain calling capabilities?

EDIT: I'd prefer to have everything working on the stock ROM if possible.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Flashing signed stock firmware:

    You need:

    Latest signed stock firmware:
    Europe (RETEU):
    https://mirrors.lolinet.com/firmware/moto/potter/official/RETEU/

    India (RETIN):
    https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

    US (RETUS):
    https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

    All other locations:
    https://mirrors.lolinet.com/firmware/moto/potter/official/

    Also:

    flashallO.bat:
    https://drive.google.com/file/d/1Ne7Kps25heUO7wsJ0Z4_X43eKQYRegoa/view?usp=sharing

    Motorola drivers:
    https://drive.google.com/file/d/0B0...=sharing&resourcekey=0-Ia2zj9jiuzpxpVp6-mfmmw

    Tiny ADB & Fastboot v1.2.0 signed;
    https://drive.google.com/file/d/1I15rjuORqmawiKUUMGSTx0R_fdXDVucH/view?usp=sharing


    1) Download the 8.1.0_OPS28.85-17-6-2 firmware for your region (it's the last one for the Moto G5+ (potter), there won't be any updates anymore, so no risk of bootloader downgrading)

    2) Install Tiny ADB & Fastboot (best place is the root directory of C: or wherever your OS resides).

    3) Extract the firmware to that ADB & Fastboot folder.

    4) Download my "flashallO.bat" and move it to that folder too.It removes the need for you to manually flash all partitions, just double-click it and it'll run all the commands for you.

    5) Download and install Motorola device drivers.The program is called "Motorola Device Manager".

    6) Reboot your phone to the bootloader. To do this, turn it off, then hold down the power and volume down buttons until you see a bugdroid undergoing open-heart surgery.
    7) Connect the phone to your PC with your USB cable. Type
    Code:
     fastboot devices
    to check if your device is connected. A serial number should be shown.
    8) Run the flashallO.bat script. (Caution: This will wipe your device completely!) It will take some time to flash, just be patient and don't worry.
    If the command window appears for a brief moment and then disappears, the device drivers may not be installed correctly. You can ask me in that case, there are some special drivers that may solve that.
    9) Once the command window closes, it should have completed the flashing process and you are safe to press the power key on the phone to start Android. Just make sure that the text near the buttons reads "START".

    That's it.

    You can save your (internal) data when you open the flashallO.bat and delete the command
    Code:
    fastboot erase userdata
    so that it will be omitted.
    I won't recommend it but it's possible.




    Rooting:

    You need:


    Magisk 23:
    https://github.com/topjohnwu/Magisk/releases/tag/v23.0
    If you have problems with the new Magisk builds (since v22) because you own an older legacy device you may try
    Magisk 20.4: https://github.com/topjohnwu/Magisk/releases/tag/v20.4

    TWRP 3.5.2_9-0:
    https://eu.dl.twrp.me/potter/twrp-3.5.2_9-0-potter.img

    Maybe you'll need:
    Disable_Dm-Verity_ForceEncrypt.zip:
    https://yadi.sk/d/HLr5vjnkA8gaqw

    - Download TWRP from the above link and place it in your ADB & Fastboot folder.
    - Download magisk.zip (and Magisk Manager APK if you use version 20.4) and place it in your internal storage.
    - Turn the phone off again and reboot to bootloader using previously mentioned key combination.
    - Navigate to the folder where you placed the TWRP image.
    - Hold down the "shift" key and right-click anywhere in the Explorer window,it should give you an option to "Open command window here."
    - Now input the command: "fastboot flash recovery [filename].img", where [filename] is the name of your TWRP image file. Tap Enter and it will take a few seconds to flash the new recovery.
    - Alternatively, you can use "fastboot boot [filename].img" to temporarily boot TWRP for the purpose of flashing Magisk. This retains the stock recovery.
    - Now that TWRP has been flashed, press the volume down key until you see the label on the side change to read "RECOVERY." At that point you can press the power button and you will boot right into TWRP.

    - If you decide to decrypt your device:
    In that case go to "Wipe" in TWRP and use "format data" (the option where you have to confirm with "yes"). Just wipe data is not enough!
    - If you want your device to stay encrypted skip that step.

    - Now press the "Install' button in TWRP and navigate to the location where the magisk.zip is located. Simply tap it and "Swipe to install."

    - If you decided to decrypt your device normally magisk should take care that it doesn't get encrypted again.
    Magisk only disables the enforced encryption flag, the device will still be encrypted and that's why a wipe of data is necessary to remove the encryption.

    If that's not the case and you get problems to reboot flash Disable_Dm-Verity_ForceEncrypt.zip after magisk.zip.

    More information about decryption/encryption:
    https://didgeridoohan.com/magisk/Magisk#hn_Disabling_dm-verity_and_forced_encryption

    - Reboot your device, if the Magisk Manager isn't installed already (it should) install the Magisk Manager APK.



    Thanks to @Jrhotrod for parts of the rooting tutorial.


    Edit: Updated Links.
    1
    Hello. I have a rooted Moto G5 Plus (Magisk) and I have also installed a Custom ROM with TWRP. I want to unroot the device and return it to absolute stock. Will this guide work in that case? If no, can anyone direct me to the correct guide?
    The above guide https://forum.xda-developers.com/t/guide-moto-g5-plus-flashing-stock-firmware-rooting-2021.4205293/ should be helpful for you. Flashing the latest signed stock firmware as described in the first part will take you to absolute stock.

    A few points to take care of:

    - Make sure that you chose the correct firmware for your location.
    - Don´t delete the fastboot erase userdata command from the flashallO.bat so that it will be omitted because some parts of Magisk or other root apps may reside at that location.

    - You have to erase everything to be on the safe side.
    - So save your internal userdata like pictures, documents, music etc. to a PC or a SD card before you start the
    process!
    - Flashing stock will overwrite the recovery.img (TWRP) and the boot.img (Magisk) so you don´t have to unroot or reflash stock recovery.

    If you want to relock your bootloader too (remember that you won´t get to the "nerver unlocked" state again, the device will flag the bootloader as "has been unlocked" even when you lock it):

    -After flashing stock firmware open a command prompt in the ADB & Fastboot folder again and give the following commands one by one or use the attached relockO.bat file. the same way you did it with the flashallO.bat:

    relockO.bat:

    fastboot oem lock fastboot oem lock 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 boot boot.img fastboot oem lock

    You can do that anytime, it hasn´t to be right after the firmware flash.
    1
    As far as I remember there is no blankflash especially for the Moto G5+, it has never been leaked.
    https://mirrors.lolinet.com/firmware/moto/potter/blankflash/
    But there is one for a very similar device, the Moto Z2play (albus).
    This post explains it a bit;

    I would try all other solutions before I'd use blankflash.
    I personally never had to but as I read there are several things thst could go wrong.
    Yes, putting a Moto device in EDL Mode should be the last thing tried.
    1
    So try LMSA and hope for the best?
    LMSA is easy to use, it takes just a few minutes to use, there are no settings to mess with, it pretty much plug and play.
    and in my experience, it either works or it doesn't.
    If it doesn't you just move on to try something else.