[Moto G5S Plus Guides, News, & Discussion] pizzaboy192:
There's a really good thread currently in this forum that has the basics for going back to stock ROM, but recently more and more people have followed it WITHOUT reading through all 60+ pages (Don't blame them) and end up with a phone that is not working properly.

This thread aims to provide the most up-to-date stock ROM links, the most current way of restoring your stock ROM, and also clear up some misconceptions about what is required for OTA compatiblity, etc.

First, a few misconceptions:

Q: Do I need to have a locked bootloader in order to get OTAs?

A: NO! You just need a fully stock system image, recovery image, bootloader image, logo.bin, and OEM partition. This means you can have your bootloader unlocked and still take OTAs. The OTA script doesn't check for that, and the OTA tool built into the phone does not check either. HOWEVER, you do need to have matching firmware, bootloader, etc to whatever version you are currently running. If you flashed a custom ROM when you were running June 1 2018 security patch, but then restore back to stock using December 1 2017 security patch, you won't get OTAs via the phone. (You can use the offline OTA download tool to sideload them just fine however)

Q: I can just flash whatever firmware I find as long as the numbers are bigger than what is currently on there, right?

A: NO! This is what a lot of people in the other thread are doing and it's screwing up phones! This thread is here to help clear up that confusion! You MUST flash the correct region for your firmware. There are FOUR kinds of Moto G5S+. All have their own model number and region. Mine is an XT1806 RETUS device. It was sold in the United States. You may have a RETIN, RETLA, RETEU, RETID or some other variant. Flashing RETIN firmware on a RETUS device will mean you won't get OTA updates. Same with flashing RETUS firmware on a RETEU device. It won't even take sideloaded OTAs since your device doesn't match anything Motorola\Lenovo ever sold.

Q: I made a backup of my device with TWRP before rooting, I'm good, right?

A: maybe. I've found that all current versions of TWRP (R20, R22, Treble-Test) do not back up the OEM partition properly. I haven't tried all the builds so far, but all the ones I've tried mount OEM as R\W which breaks OTA, even after a restore via TWRP. (The R22 seems to touch it no matter what on booting TWRP so you'll need to reflash it via Fastboot from a stock image file in order to take OTAs, or use R20 which didn't touch it unless you tried to restore a backup)

Q: I skipped all the above and flashed wrong firmware from the links below, locked my bootloader, and now nothing works.

A: Don't skip the notes next time. See if you can get an unlock code and try again.

Q: I don't know what kind of phone I have?

A: Put the device in fastboot mode (Can either do ADB reboot bootloader, or hold the Volume Down button while turning it on) and on a computer with ADB and Fastboot installed type

fastboot devices

If you get an output that matches the serial of your phone, type

fastboot getvar all

Copy that, paste it into a .txt file and upload it here, share it to pastebin, post it here in the CODE tags, just share it so we can see what version your device is and point you in the right direction. Better to do it once than twice, right? It's suggested you read through it and remove your devices IMEI (and serial number if you'd like) for security reasons. I've yet to see anything practical happen to publicly posted IMEI numbers but you never know.

Right, now for the meat of the tutorial.

1: BACKUP YOUR ENTIRE DEVICE USING TWRP. Save that backup. If you don't care about your data, don't back that up, but back up everything. You'll need to back up to something that supports larger than 4GB files (So not FAT32, I believe TWRP supports NTFS, internal storage works too if you've got ~12gb free, USB OTG works). It's best to do this just in case something goes crazy wrong you still have a backup. If you don't backup and then something goes wrong, it's not my fault.

2: Grab the latest firmware for your device so that you know for a fact that it's updating ALL bits of the device. As of this writing (September 4th, 2018) it is June 1 2018 security patch. The links below have the firmware for the 4 major regions: RETEU, RETIN, RETBR, and RETUS

FOR RETEU, RETIN, RETBR, use this link.

For RETUS, use this link.

Once newer full firmware files are available, I will update links accordingly.

3: Install Minimal ADB & Fastboot. This is required to run the fastboot getvar all command, and is required to flash stock firmware.

4: Extract the stock firmware .zip file into the ADB & fastboot directory for ease of use.

5: Run these commands: PLEASE NOTE RUNNING THESE COMMANDS WILL WIPE ALL YOUR DATA FROM YOUR DEVICE. Backup EVERYTHING. Even your pictures & whatnot. Remove your SD card if you're super worried. This will return the device to a completely factory reset device. No pictures, no SMS messages, nothing survives this. Please understand this. If you're running modded stock and want to keep your data, omit the fastboot erase userdata line. these commands will NOT wipe your modem. You will still have an IMEI after. you'll need to follow the tutorial on making sure your persist is intact to get VOLTE working and other issues fixed with your persist & IMEI should you notice issues after flashing.

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 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 oem oem.img
fastboot erase cache
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot

Let your device boot. enjoy the obxnoious Lenovo boot splash they created just to terrify you in the middle of the night when your phone reboots for no reason. If it all went well, your device should reboot to a stock Android 7.1.1 June 1 2018 build.

If you have issues, please share them so we can make sure nobody else gets stuck on the wrong firmware with bad information.