Today we will be unrooting the Moto G5 Plus. If you have not rooted your phone, then you can see our tutorial on how you can root Moto G5 Plus, and how you can install Lineage OS on it. You can easily unroot your device, by following some simple steps. Make sure you initialize the commands in the exact order as given.
First download the Stock Moto G5 ROM zip file. Make sure you download the latest one.
Next, download and install the Motorola Device Manager. You can skip this step if you have installed it already.
You also need Android SDK Tools, to run fastboot.
After you download all these files, extract platform tools and the Stock Motorola ROM zip file.
Next, open the Platform tools folder, hold the Shift key, and right-click with your mouse. Now select Open command window here.
Switch off your mobile and restart it in Bootloader mode by pressing the Power key and the Volume Down key together.
Next connect your mobile to your computer.
Now run these commands one by one in command prompt.
fastboot devices
fastboot oem fb_mode_set
fastboot oem lock
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 modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem lock
fastboot oem fb_mode_clear
fastboot reboot
After all these commands are completed, your phone will automatically restart.
This was the simple way to unroot your Moto G5 Plus. After unrooting and installing the stock OS on your Moto G5 Plus, you will still see the Bootloader unlocked warning. See this video to remove the bootloader unlocked warning on Moto G5 Plus.