[Moto G5 Questions & Answers] He.Art:
Hello, how are you? My Name Is Cristian and I'm from Argentina.

I've had a Moto G5 for a while and a lot of custom roms were installed on it. However, there were many problems in the process. The roms had bugs, performance issues, and some didn't even boot.

So i made the decision to go back to the factory rom and close the bootloader forever. But it couldn't. Something prevented it. Something was causing the phone to not start properly.

Therefore, after doing so many laps, i was able to do the whole process.

And today i publish this topic so that you can do it too. I hope you can come out triumphant in the process just like me. Have lucky! :)

1) The first thing you should do is download Rescue & Smart assistant. Install on your pc and create account (if you not) or login in.

https://support.lenovo.com/es/es/downloads/DS101291

2) You will need to find the official firmware of your device. Search for the exact device SKU (model of your phone) and exact region. For example the SKU of my device is XT1670 the region is RETAR (from Argentina). If you are from United States (and try to install RETAR) Rescue & Smart assistant will not recognize the SKU of your device, and will not be able to continue.

Find the exact firmware corresponding to your mobile phone.

https://mirrors.lolinet.com/firmware/moto/cedric/official/

Unzip the rom in the place that you prefer.

3) Now put your device in bootloader mode and execute the following commands (ignoring any errors in the process)

fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
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 erase cache
fastboot erase userdata
fastboot reboot

4) Once the above process is finished, start your phone normally. Go to the developer options and activate usb debugging. Plug the phone into PC.

Open "Rescue & Smart assistant" and accept usb debugging on your phone. The app installs some control app, dont worry.

Go to Rescue & Smart assistant and select "Rescue". The program will recognize your phone's SKU if you downloaded the correct firmware. Otherwise, if a wrong sign appears, you will have to repeat step 2 and 3 with the correct firmware.

Click on "Rescue now" and the program will download the firmware corresponding to your phone. After this, the firmware installation will begin.

Why do all this process?

The Rescue & Smart app is official from Motorola. When the official firmware is installed, the signed firmware files are also installed with it. The firmware is official because is delivered directly by Motorola, specifically for your mobile phone, and not by unofficial sites.

5) Hey, wait! the bootloader needs to be blocked. True.

Go to C:\ProgramData\LMSA\Download\RomFiles and you will find there the official rom downloaded by "Rescue & Smart". This rom is unique, signed and official. Only for your phone, only for its hardware. Do not lose it. It will save your ass from many inconveniences, if one day you want to continue experimenting with your phone.

Copy the whole directory in other site and open cmd in it. Now shutdown your phone and start it in bootloader mode.

Now put these commands (ignoring bla bla bla errors):

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

And that's it. Your mobile phone is now official and with its bootloader locked. almost factory-made.

So thank you for reading all this and I hope the information has served you a lot. Any questions about it (about this) do not hesitate to consult.