[Moto G5 Questions & Answers] Tiki Thorsen:
Hello, I am planning to sell my phone, so I want to restore the stock ROM and lock the bootloader.

When trying to perform a Rescue with "Rescue and Smart Assistant" it gives me an error, it fails to find the matching firmware (it works correctly with a G4 Plus on the same cable and computer)

I was on the LineageOS 18 previously, I rebooted to fastboot and flashed "CEDRIC_RETAIL_8.1.0_OPP28.85-19-4-2_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml"

from https://mirrors-obs-2.lolinet.com/firmware/motorola/2017/cedric/official/.

Trying to lock the bootloader (it remans unlocked) gives me the following error: "(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer Options"

OEM UNLOCK is grey out under Developer options.

I used these commands:

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 flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot oem fb_mode_clear
fastboot reboot

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

These was the result:

C:\Users\Administrator\Desktop\ADB>fastboot oem fb_mode_set
...
OKAY [ 0.004s]
finished. total time: 0.004s

C:\Users\Administrator\Desktop\ADB>fastboot flash partition gpt.bin
target reported max download size of 535822336 bytes
sending 'partition' (45 KB)...
OKAY [ 0.004s]
writing 'partition'...
(bootloader) Validating 'gpt.default.xml'
(bootloader) Committing 'gpt.default.xml'
(bootloader) - flashing 'gpt_main0.bin' to 'partition:0'
(bootloader) Flashing primary GPT image...
(bootloader) Flashing backup GPT image...
OKAY [ 0.079s]
finished. total time: 0.082s

C:\Users\Administrator\Desktop\ADB>fastboot flash bootloader bootloader.img
target reported max download size of 535822336 bytes
sending 'bootloader' (5179 KB)...
OKAY [ 0.165s]
writing 'bootloader'...
(bootloader) Validating 'bootloader.default.xml'
(bootloader) Committing 'bootloader.default.xml'
(bootloader) - flashing 'emmc_appsboot.mbn' to 'aboot'
(bootloader) - flashing 'rpm.mbn' to 'rpm'
(bootloader) - flashing 'tz.mbn' to 'tz'
(bootloader) - flashing 'devcfg.mbn' to 'devcfg'
(bootloader) - flashing 'cmnlib.mbn' to 'cmnlib'
(bootloader) - flashing 'cmnlib64.mbn' to 'cmnlib64'
(bootloader) - flashing 'keymaster.mbn' to 'keymaster'
(bootloader) - flashing 'prov.mbn' to 'prov'
(bootloader) - flashing 'sbl1.mbn' to 'sbl1'
OKAY [ 0.363s]
finished. total time: 0.529s

C:\Users\Administrator\Desktop\ADB>fastboot flash logo logo.bin
target reported max download size of 535822336 bytes
sending 'logo' (2242 KB)...
OKAY [ 0.073s]
writing 'logo'...
OKAY [ 0.051s]
finished. total time: 0.124s

C:\Users\Administrator\Desktop\ADB>fastboot flash boot boot.img
target reported max download size of 535822336 bytes
sending 'boot' (16384 KB)...
OKAY [ 0.572s]
writing 'boot'...
(bootloader) Image signed with key bad key
OKAY [ 0.243s]
finished. total time: 0.817s

C:\Users\Administrator\Desktop\ADB>fastboot flash recovery recovery.img
target reported max download size of 535822336 bytes
sending 'recovery' (16484 KB)...
OKAY [ 0.566s]
writing 'recovery'...
(bootloader) Image signed with key bad key
OKAY [ 0.272s]
finished. total time: 0.838s

C:\Users\Administrator\Desktop\ADB>fastboot flash dsp adspso.bin
target reported max download size of 535822336 bytes
sending 'dsp' (16384 KB)...
OKAY [ 0.517s]
writing 'dsp'...
OKAY [ 0.143s]
finished. total time: 0.661s

C:\Users\Administrator\Desktop\ADB>fastboot flash oem oem.img
target reported max download size of 535822336 bytes
sending 'oem' (148900 KB)...
OKAY [ 4.686s]
writing 'oem'...
OKAY [ 1.040s]
finished. total time: 5.726s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.0
target reported max download size of 535822336 bytes
sending 'system' (256533 KB)...
OKAY [ 8.758s]
writing 'system'...
OKAY [ 2.132s]
finished. total time: 10.892s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.1
target reported max download size of 535822336 bytes
sending 'system' (256653 KB)...
OKAY [ 8.747s]
writing 'system'...
OKAY [ 1.729s]
finished. total time: 10.477s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.2
target reported max download size of 535822336 bytes
sending 'system' (257982 KB)...
OKAY [ 8.878s]
writing 'system'...
OKAY [ 1.804s]
finished. total time: 10.682s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.3
target reported max download size of 535822336 bytes
sending 'system' (260705 KB)...
OKAY [ 8.936s]
writing 'system'...
OKAY [ 1.738s]
finished. total time: 10.675s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.4
target reported max download size of 535822336 bytes
sending 'system' (257421 KB)...
OKAY [ 8.845s]
writing 'system'...
OKAY [ 1.753s]
finished. total time: 10.599s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.5
target reported max download size of 535822336 bytes
sending 'system' (257865 KB)...
OKAY [ 8.868s]
writing 'system'...
OKAY [ 1.719s]
finished. total time: 18.835s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.6
target reported max download size of 535822336 bytes
sending 'system' (252647 KB)...
OKAY [ 8.721s]
writing 'system'...
OKAY [ 2.085s]
finished. total time: 10.807s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.7
target reported max download size of 535822336 bytes
sending 'system' (253716 KB)...
OKAY [ 8.756s]
writing 'system'...
OKAY [ 2.048s]
finished. total time: 10.804s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.8
target reported max download size of 535822336 bytes
sending 'system' (250269 KB)...
OKAY [ 8.723s]
writing 'system'...
OKAY [ 1.691s]
finished. total time: 10.415s

C:\Users\Administrator\Desktop\ADB>fastboot flash modem NON-HLOS.bin
target reported max download size of 535822336 bytes
sending 'modem' (66362 KB)...
OKAY [ 2.265s]
writing 'modem'...
OKAY [ 0.542s]
finished. total time: 2.807s

C:\Users\Administrator\Desktop\ADB>fastboot erase modemst1
erasing 'modemst1'...
OKAY [ 0.017s]
finished. total time: 0.017s

C:\Users\Administrator\Desktop\ADB>fastboot erase modemst2
erasing 'modemst2'...
OKAY [ 0.017s]
finished. total time: 0.018s

C:\Users\Administrator\Desktop\ADB>fastboot flash fsg fsg.mbn
target reported max download size of 535822336 bytes
sending 'fsg' (2956 KB)...
OKAY [ 0.103s]
writing 'fsg'...
OKAY [ 0.056s]
finished. total time: 0.159s

C:\Users\Administrator\Desktop\ADB>fastboot erase cache
erasing 'cache'...
OKAY [ 0.008s]
finished. total time: 0.008s

C:\Users\Administrator\Desktop\ADB>fastboot erase userdata
erasing 'userdata'...
OKAY [ 0.065s]
finished. total time: 0.065s

C:\Users\Administrator\Desktop\ADB>fastboot erase customize (ignore any error)
fastboot: usage: unknown command (ignore

C:\Users\Administrator\Desktop\ADB>fastboot erase clogo (ignore any error)
fastboot: usage: unknown command (ignore

C:\Users\Administrator\Desktop\ADB>fastboot oem fb_mode_clear
...
OKAY [ 0.003s]
finished. total time: 0.004s

C:\Users\Administrator\Desktop\ADB>fastboot reboot
rebooting...

finished. total time: 0.002s

C:\Users\Administrator\Desktop\ADB>fastboot oem lock
...
(bootloader) WARNING: This command erases all user data.
(bootloader) Please re-run this command to continue.
OKAY [ 0.004s]
finished. total time: 0.005s

C:\Users\Administrator\Desktop\ADB>fastboot oem lock
...
(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer
(bootloader) Options
OKAY [ 0.005s]
finished. total time: 0.005s

C:\Users\Administrator\Desktop\ADB>fastboot flash oem oem.img
target reported max download size of 535822336 bytes
sending 'oem' (148900 KB)...
OKAY [ 5.139s]
writing 'oem'...
OKAY [ 1.014s]
finished. total time: 6.154s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.0
target reported max download size of 535822336 bytes
sending 'system' (256533 KB)...
OKAY [ 8.799s]
writing 'system'...
OKAY [ 2.135s]
finished. total time: 10.935s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.1
target reported max download size of 535822336 bytes
sending 'system' (256653 KB)...
OKAY [ 8.787s]
writing 'system'...
OKAY [ 1.733s]
finished. total time: 10.521s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.2
target reported max download size of 535822336 bytes
sending 'system' (257982 KB)...
OKAY [ 9.106s]
writing 'system'...
OKAY [ 1.809s]
finished. total time: 10.916s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.3
target reported max download size of 535822336 bytes
sending 'system' (260705 KB)...
OKAY [ 9.007s]
writing 'system'...
OKAY [ 1.745s]
finished. total time: 10.753s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.4
target reported max download size of 535822336 bytes
sending 'system' (257421 KB)...
OKAY [ 8.863s]
writing 'system'...
OKAY [ 1.766s]
finished. total time: 10.631s

C:\Users\Administrator\Desktop\ADB>fastboot flash boot boot.img
target reported max download size of 535822336 bytes
sending 'boot' (16384 KB)...
OKAY [ 0.563s]
writing 'boot'...
(bootloader) Image signed with key bad key
OKAY [ 0.244s]
finished. total time: 0.808s

C:\Users\Administrator\Desktop\ADB>fastboot oem lock
...
(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer
(bootloader) Options
OKAY [ 0.005s]
finished. total time: 0.005s

C:\Users\Administrator\Desktop\ADB>
C:\Users\Administrator\Desktop\ADB>fastboot oem fb_mode_set
...
OKAY [ 0.003s]
finished. total time: 0.003s

C:\Users\Administrator\Desktop\ADB>fastboot flash partition gpt.bin
target reported max download size of 535822336 bytes
sending 'partition' (45 KB)...
OKAY [ 0.004s]
writing 'partition'...
(bootloader) Validating 'gpt.default.xml'
(bootloader) Committing 'gpt.default.xml'
(bootloader) - flashing 'gpt_main0.bin' to 'partition:0'
(bootloader) Flashing primary GPT image...
(bootloader) Flashing backup GPT image...
OKAY [ 0.087s]
finished. total time: 0.092s

C:\Users\Administrator\Desktop\ADB>fastboot flash bootloader bootloader.img
target reported max download size of 535822336 bytes
sending 'bootloader' (5179 KB)...
OKAY [ 0.165s]
writing 'bootloader'...
(bootloader) Validating 'bootloader.default.xml'
(bootloader) Committing 'bootloader.default.xml'
(bootloader) - flashing 'emmc_appsboot.mbn' to 'aboot'
(bootloader) - flashing 'rpm.mbn' to 'rpm'
(bootloader) - flashing 'tz.mbn' to 'tz'
(bootloader) - flashing 'devcfg.mbn' to 'devcfg'
(bootloader) - flashing 'cmnlib.mbn' to 'cmnlib'
(bootloader) - flashing 'cmnlib64.mbn' to 'cmnlib64'
(bootloader) - flashing 'keymaster.mbn' to 'keymaster'
(bootloader) - flashing 'prov.mbn' to 'prov'
(bootloader) - flashing 'sbl1.mbn' to 'sbl1'
OKAY [ 0.351s]
finished. total time: 0.517s

C:\Users\Administrator\Desktop\ADB>fastboot flash logo logo.bin
target reported max download size of 535822336 bytes
sending 'logo' (2242 KB)...
OKAY [ 0.073s]
writing 'logo'...
OKAY [ 0.060s]
finished. total time: 0.133s

C:\Users\Administrator\Desktop\ADB>fastboot flash boot boot.img
target reported max download size of 535822336 bytes
sending 'boot' (16384 KB)...
OKAY [ 0.570s]
writing 'boot'...
(bootloader) Image signed with key bad key
OKAY [ 0.235s]
finished. total time: 0.806s

C:\Users\Administrator\Desktop\ADB>fastboot flash recovery recovery.img
target reported max download size of 535822336 bytes
sending 'recovery' (16484 KB)...
OKAY [ 0.578s]
writing 'recovery'...
(bootloader) Image signed with key bad key
OKAY [ 0.275s]
finished. total time: 0.853s

C:\Users\Administrator\Desktop\ADB>fastboot flash dsp adspso.bin
target reported max download size of 535822336 bytes
sending 'dsp' (16384 KB)...
OKAY [ 0.517s]
writing 'dsp'...
OKAY [ 0.155s]
finished. total time: 0.672s

C:\Users\Administrator\Desktop\ADB>fastboot flash oem oem.img
target reported max download size of 535822336 bytes
sending 'oem' (148900 KB)...
OKAY [ 4.687s]
writing 'oem'...
OKAY [ 1.033s]
finished. total time: 5.720s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.0
target reported max download size of 535822336 bytes
sending 'system' (258344 KB)...
OKAY [ 8.906s]
writing 'system'...
OKAY [ 1.799s]
finished. total time: 10.706s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.1
target reported max download size of 535822336 bytes
sending 'system' (256570 KB)...
OKAY [ 8.772s]
writing 'system'...
OKAY [ 1.733s]
finished. total time: 10.506s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.2
target reported max download size of 535822336 bytes
sending 'system' (246510 KB)...
OKAY [ 8.335s]
writing 'system'...
OKAY [ 2.046s]
finished. total time: 10.382s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.3
target reported max download size of 535822336 bytes
sending 'system' (262141 KB)...
OKAY [ 9.027s]
writing 'system'...
OKAY [ 1.763s]
finished. total time: 10.791s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.4
target reported max download size of 535822336 bytes
sending 'system' (261322 KB)...
OKAY [ 9.199s]
writing 'system'...
OKAY [ 1.774s]
finished. total time: 10.975s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.5
target reported max download size of 535822336 bytes
sending 'system' (262141 KB)...
OKAY [ 8.308s]
writing 'system'...
OKAY [ 1.757s]
finished. total time: 10.066s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.6
target reported max download size of 535822336 bytes
sending 'system' (262143 KB)...
OKAY [ 8.247s]
writing 'system'...
OKAY [ 2.177s]
finished. total time: 10.424s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.7
target reported max download size of 535822336 bytes
sending 'system' (256817 KB)...
OKAY [ 8.080s]
writing 'system'...
OKAY [ 2.079s]
finished. total time: 10.159s

C:\Users\Administrator\Desktop\ADB>fastboot flash system system.img_sparsechunk.8
target reported max download size of 535822336 bytes
sending 'system' (237909 KB)...
OKAY [ 7.484s]
writing 'system'...
OKAY [ 1.589s]
finished. total time: 9.074s

C:\Users\Administrator\Desktop\ADB>fastboot flash modem NON-HLOS.bin
target reported max download size of 535822336 bytes
sending 'modem' (66358 KB)...
OKAY [ 2.277s]
writing 'modem'...
OKAY [ 0.544s]
finished. total time: 2.821s

C:\Users\Administrator\Desktop\ADB>fastboot erase modemst1
erasing 'modemst1'...
OKAY [ 0.025s]
finished. total time: 0.026s

C:\Users\Administrator\Desktop\ADB>fastboot erase modemst2
erasing 'modemst2'...
OKAY [ 0.017s]
finished. total time: 0.017s

C:\Users\Administrator\Desktop\ADB>fastboot flash fsg fsg.mbn
target reported max download size of 535822336 bytes
sending 'fsg' (2956 KB)...
OKAY [ 0.104s]
writing 'fsg'...
OKAY [ 0.057s]
finished. total time: 0.161s

C:\Users\Administrator\Desktop\ADB>fastboot erase cache
erasing 'cache'...
OKAY [ 0.007s]
finished. total time: 0.007s

C:\Users\Administrator\Desktop\ADB>fastboot erase userdata
erasing 'userdata'...
OKAY [ 0.064s]
finished. total time: 0.064s

C:\Users\Administrator\Desktop\ADB>fastboot oem fb_mode_clear
...
OKAY [ 0.004s]
finished. total time: 0.004s

C:\Users\Administrator\Desktop\ADB>fastboot reboot
rebooting...

finished. total time: 0.002s

C:\Users\Administrator\Desktop\ADB>