• 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

DEJAVU54

Member
Jul 10, 2020
22
0

Attachments

  • sgss.PNG
    sgss.PNG
    108.7 KB · Views: 16

sd_shadow

Recognized Contributor
Sep 21, 2011
18,090
1
8,675
South Dakota
goo.gl
Motorola Droid X
Moto X4
How do I know which version from lolinet to install? I'm from Argentina.
Use the Device Model #, Codename, and Software Channel
 
  • Like
Reactions: Wolfcity

Fedegblack

New member
Jul 11, 2018
4
0
Use the Device Model #, Codename, and Software Channel

Thank you, I managed to get the correct file. One problem though, I followed every step without any trouble but didn't manage to fix what I was looking to fix, which is a bootloop. It was on a stock phone and removed the userdata line to keep the files.
Question now is, how to proceed, how to troubleshoot and if deleting userdata would be a sure fix since I don't want to lose it for nothing.

Thanks again for the help.
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,350
2,753
Germany
Moto G 2014
Moto G5 Plus
Thank you, I managed to get the correct file. One problem though, I followed every step without any trouble but didn't manage to fix what I was looking to fix, which is a bootloop. It was on a stock phone and removed the userdata line to keep the files.
Question now is, how to proceed, how to troubleshoot and if deleting userdata would be a sure fix since I don't want to lose it for nothing.

Thanks again for the help.
So you flashed the stock firmware to fix a bootloop? What caused that bootloop in the first case?
Are you rooted? If yes any modules installed ?
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,350
2,753
Germany
Moto G 2014
Moto G5 Plus
Yes, flashed stock on stock. No root, and I have no idea what caused the bootloop.
The bootloop (or is it more a problem like booting into Fastboot mode/ stop booting at all?) appeared out of the blue? Nothing you remember that you did before?
Maybe it would be better to delete/format data too.

You can also try LMSA (Lenovo Moto Smart Assistant, now called Rescue and Smart Assistant) to flash stock firmware, some users fixed their problem that way:
 

Fedegblack

New member
Jul 11, 2018
4
0
The bootloop (or is it more a problem like booting into Fastboot mode/ stop booting at all?) appeared out of the blue? Nothing you remember that you did before?
Maybe it would be better to delete/format data too.

You can also try LMSA (Lenovo Moto Smart Assistant, now called Rescue and Smart Assistant) to flash stock firmware, some users fixed their problem that way:

It's an inconsistent bootloop where it shows the moto logo for a minute and then starts blinking every now and then, and sometimes it displays "hello moto". But never reaches full boot. I asked what the person did before the loop but seems pretty ordinary usage. I'll try then with the addition of data loss.

Thanks.

Update: LMSA did the job.
 
Last edited:

WordsworthFhang

New member
Dec 14, 2017
2
0
Hi. I'm trying to root my G5+ but when I try and flash TWRP in line with the instructions above (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.), I get the following:

C:\adb>fastboot flash recovery twrp.img
target reported max download size of 534773760 bytes
sending 'recovery' (17424 KB)...
OKAY [ 0.391s]
writing 'recovery'...
(bootloader) Image not signed or corrupt
OKAY [ 0.312s]
finished. total time: 0.703s

So the process fails.

I've tried the most recent two .img releases from TWRP (https://eu.dl.twrp.me/potter/), twrp-3.5.2_9-0-potter.img and twrp-3.5.1_9-0-potter.img, but both give the same result.

Any thoughts gratefully received :)
 

sd_shadow

Recognized Contributor
Sep 21, 2011
18,090
1
8,675
South Dakota
goo.gl
Motorola Droid X
Moto X4
Hi. I'm trying to root my G5+ but when I try and flash TWRP in line with the instructions above (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.), I get the following:

C:\adb>fastboot flash recovery twrp.img
target reported max download size of 534773760 bytes
sending 'recovery' (17424 KB)...
OKAY [ 0.391s]
writing 'recovery'...
(bootloader) Image not signed or corrupt
OKAY [ 0.312s]
finished. total time: 0.703s

So the process fails.

I've tried the most recent two .img releases from TWRP (https://eu.dl.twrp.me/potter/), twrp-3.5.2_9-0-potter.img and twrp-3.5.1_9-0-potter.img, but both give the same result.

Any thoughts gratefully received :)
If you just want root, use the patched boot.img method.
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,350
2,753
Germany
Moto G 2014
Moto G5 Plus
Hi. I'm trying to root my G5+ but when I try and flash TWRP in line with the instructions above (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.), I get the following:

C:\adb>fastboot flash recovery twrp.img
target reported max download size of 534773760 bytes
sending 'recovery' (17424 KB)...
OKAY [ 0.391s]
writing 'recovery'...
(bootloader) Image not signed or corrupt
OKAY [ 0.312s]
finished. total time: 0.703s

So the process fails.

I've tried the most recent two .img releases from TWRP (https://eu.dl.twrp.me/potter/), twrp-3.5.2_9-0-potter.img and twrp-3.5.1_9-0-potter.img, but both give the same result.

Any thoughts gratefully received :)

As @sd_shadow posted above, if it's just for rooting use the patch boot.img method.
Else:
Have you booted into TWRP after flashing it to make it stick before booting into system?
Because the message you got doesn't say that the process failed. TWRP images are signed with their own key so "not signed" is a normal output.
That the image could be corrupted is most probably not true as you tried different ones and not all of them should be damaged when being downloaded.
Also the process ends with "okay".
But to make sure that there's nothing wrong in the download process use another browser for downloading the image and try again.
There were reports that some browsers have problems, namely Firefox.
 
Last edited:
  • Like
Reactions: sd_shadow

CharlieGarg

Senior Member
Jan 5, 2013
134
14
Punjab
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/0B0WGdtNWubBJYnlDcWRBZXltanc/view?usp=sharing

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


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 all download links.
i have done all the steps as above but i got network error. It shows no service after the installation. I have did as above multiple times but nothing changed. Even after installing twrp, i formatted all the system and flash the rom again using "flashallO.bat". Previously i was on Arrow OS 10.0. Now when i flash the Arrow Os again, i got network back. Please help so that i can switch back to stock. Thank You.
 

Wolfcity

Recognized Contributor
Apr 26, 2013
4,350
2,753
Germany
Moto G 2014
Moto G5 Plus
i have done all the steps as above but i got network error. It shows no service after the installation. I have did as above multiple times but nothing changed. Even after installing twrp, i formatted all the system and flash the rom again using "flashallO.bat". Previously i was on Arrow OS 10.0. Now when i flash the Arrow Os again, i got network back. Please help so that i can switch back to stock. Thank You.
Her area few points to take care of:

- Make sure that you choose the correct firmware for your location. (e.g. RETIN for India)

If you were rooted and in some cases coming from a custom ROM:

- 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


As a last resort you can try LMSA (Lenovo Motorola Smart Assistant):
 
Last edited:
  • Like
Reactions: sd_shadow

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    i have done all the steps as above but i got network error. It shows no service after the installation. I have did as above multiple times but nothing changed. Even after installing twrp, i formatted all the system and flash the rom again using "flashallO.bat". Previously i was on Arrow OS 10.0. Now when i flash the Arrow Os again, i got network back. Please help so that i can switch back to stock. Thank You.
    Her area few points to take care of:

    - Make sure that you choose the correct firmware for your location. (e.g. RETIN for India)

    If you were rooted and in some cases coming from a custom ROM:

    - 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


    As a last resort you can try LMSA (Lenovo Motorola Smart Assistant):
    1
    Whenever i flash stock image, imei no becomes '0' and flshing any custom rom 10.0 or higher restores the imei number. So can you please tell me what to do? Also using LMA when i am on bootloader screen it shows IMEI number but when phone booted up, it shows imei number 0
    So you flashed the firmware by LMSA?
    Have you erased your persist.img at some point?
    Maybe a custom ROM has changed something in your persist partition.
    What does the getvar all command return?
  • 3
    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/0B0WGdtNWubBJYnlDcWRBZXltanc/view?usp=sharing

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


    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 all download 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.