For some reason, owners of the Moto Z2 Play are reporting that the device tends to reboot to recovery instead of directly to the system. This tends to happen after flashing a custom recovery such as TWRP, or a custom ROM.
For example, you might flash TWRP + LOS ROM, and after formatting internal storage, you will receive the dreaded “Error 255”.
After some testing with various XDA users, including flashing various TWRP versions and stock ROMs, it turns out that a potential solution involves downgrading to the official Nougat ROM, and using a custom .bat file to flash the phone.
So if you are one of the people experiencing Moto Z2 Play booting directly to recovery, try this solution and report if it works for you in our comments.
If you are on Oreo, a direct downgrade to Android Nougat may not be possible. You would need to format the entire phone via TWRP recovery, then boot to the bootloader and flash the stock ROM.
Another issue is that RSDlite (the flashing and unbricking tool for Motorola) typically does not work on Windows 10, if that is your OS.
In any case, we need to convert servicefile.xml to servicefile.bat for a simple flashing.
So you should download the latest firmware for your Moto Z2 Play.
The firmware will come as a .zip file – you need to extract the servicefile.xml from the ZIP, and edit it in Notepad++.
Now create a new text document on your computer, and name it something like “servicefile.bat”, which will automatically create a batch file.
Now right-click this new batch file and edit it with Notepad+
In this batch file, type the following lines at the top of the document:
Echo off Pause Fastboot reboot Exit
Save the file. Now go back to the original servicefile.xml and also open it in Notepad++
In the servicefile.xml you want to copy everything beginning from the line <step interface=”A2”> (should be line 11) all the way down to </steps>, but do not copy </steps>, only the line above it.
Your .bat file should now look like this:
Now you want to delete all the parts of the lines that say <step MD5=xxxxxxxx”, so all the lines only begin with “filename=*xxxxx (see picture below)
Next you need to also erase the bits that say <step operation=, so you are only left with “erase” as the beginning of the line – honestly if this is confusing, you can download the pre-made .bat file from the Downloads of this guide, and use it as a reference.
So now below the first line “echo off”, you want to change every single line to have “fastboot” before it”. So for example line 2 should now read “fastboot getvar” etc. Do this for every line – again, see the picture for reference.
Finally at the bottom of the .bat file, add these lines:
Operation partition filename Operation var Operation partition
Now you can save and close the .bat file.
Now copy the servicefile.bat and also fastboot.exe, and adb.exe and the ADB .dll files from your ADB installation, and copy them into the extracted ROM folder.
Launch ADB terminal on your PC, and make sure ADB connection is recognized by typing ‘adb devices’
Now you can go ahead and double-click the .bat file you created, and it will automatically flash the stock firmware onto your Moto Z2 Play via the ADB terminal.
Flashing an entire firmware package may take a while, so we suggest going off and doing something while you wait – a few levels of Short Life should do the trick (because who doesn’t enjoy crawling towards a finish line on severed stumps?)
Now you should be able to upgrade directly to the latest Oreo OTA, and it should no longer directly boot to recovery when custom recovery is installed.