[G 2014 Q&A, Help & Troubleshooting] bharat@xda-devlopers:
Hi,

I have a XT1033 with unlocked bootloader, dotOS (custom rom) and TWRP 3.2.3.0 (custom recovery).

I decided to lock the bootloader and unroot my device by flashing stock rom and locking the oem, but unable to do so. I have previously once unlocked the bootloader and the after some weeks locked it again, but now when i follow the same procedure to lock the bootloader again, it didnt work.

What i did ?

I have downloaded firmware for my device (XT1033), and started to flash it with the following commands:

mfastboot.exe oem lock begin

mfastboot.exe flash partition gpt.bin

mfastboot.exe flash motoboot motoboot.img

mfastboot.exe flash logo logo.bin

mfastboot.exe flash logo logo.bin

mfastboot.exe flash recovery recovery.img

mfastboot.exe flash system system.img_sparsechunk.0

mfastboot.exe flash system system.img_sparsechunk.1

mfastboot.exe flash system system.img_sparsechunk.2

mfastboot.exe flash system system.img_sparsechunk.3

mfastboot.exe flash modem NON-HLOS.bin

mfastboot.exe erase modemst1

mfastboot.exe erase modemst2

mfastboot.exe flash fsg fsg.mbn

mfastboot.exe erase cache

mfastboot.exe erase userdata

mfastboot.exe oem lock

pause

mfastboot.exe reboot

After doing mfastboot.exe oem lock it says "hab check failed system failed to validate system image" and when i execute mfastboot.exe reboot, the device goes into a bootloop...

I have somehow repaired the thing (was able to access bootloader so flashed TWRP recovery, formatted the partitions, mounted /cache, /system, /data, flashed a custom rom, gapps) but i want the bootloader to be locked.

Here are the logs in case you need them..

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe devices

TA93401HLM fastboot

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe devices

TA93401HLM fastboot

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe oem lock begin

...

(bootloader) Ready to flash signed images

OKAY [ 2.832s]

finished. total time: 2.842s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash partition gpt.bin

target max-sparse-size: 256MB

sending 'partition' (32 KB)...

OKAY [ 0.030s]

writing 'partition'...

(bootloader) This may take a few seconds, if a

(bootloader) different partition table is being

(bootloader) flashed since we need to backup

(bootloader) and restore a few partitions

(bootloader) Flashing primary GPT image...

(bootloader) Flashing backup GPT image...

OKAY [ 0.331s]

finished. total time: 0.381s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash motoboot motoboot.

img

target max-sparse-size: 256MB

sending 'motoboot' (1953 KB)...

OKAY [ 0.120s]

writing 'motoboot'...

(bootloader) flashing tz ...

(bootloader) flashing rpm ...

(bootloader) flashing sdi ...

(bootloader) flashing aboot ...

(bootloader) flashing sbl1 ...

OKAY [ 1.052s]

finished. total time: 1.192s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash logo logo.bin

target max-sparse-size: 256MB

sending 'logo' (295 KB)...

OKAY [ 0.060s]

writing 'logo'...

OKAY [ 0.080s]

finished. total time: 0.160s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash recovery recovery.

img

target max-sparse-size: 256MB

sending 'recovery' (10240 KB)...

OKAY [ 0.410s]

writing 'recovery'...

OKAY [ 0.710s]

finished. total time: 1.140s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash system system.img_

sparsechunk.0

target max-sparse-size: 256MB

sending 'system' (257755 KB)...

OKAY [ 8.671s]

writing 'system'...

OKAY [ 10.939s]

finished. total time: 19.615s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash system system.img_

sparsechunk.1

target max-sparse-size: 256MB

sending 'system' (256953 KB)...

OKAY [ 8.697s]

writing 'system'...

OKAY [ 10.259s]

finished. total time: 18.976s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash system system.img_

sparsechunk.2

target max-sparse-size: 256MB

sending 'system' (260396 KB)...

OKAY [ 8.825s]

writing 'system'...

OKAY [ 10.299s]

finished. total time: 19.154s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash system system.img_

sparsechunk.3

target max-sparse-size: 256MB

sending 'system' (166572 KB)...

OKAY [ 5.654s]

writing 'system'...

OKAY [ 7.516s]

finished. total time: 13.180s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash modem NON-HLOS.bin

target max-sparse-size: 256MB

sending 'modem' (49376 KB)...

OKAY [ 1.732s]

writing 'modem'...

OKAY [ 1.230s]

finished. total time: 2.982s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe erase modemst1

erasing 'modemst1'...

OKAY [ 0.030s]

finished. total time: 0.040s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe erase modemst2

erasing 'modemst2'...

OKAY [ 0.030s]

finished. total time: 0.040s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe flash fsg fsg.mbn

target max-sparse-size: 256MB

sending 'fsg' (103 KB)...

OKAY [ 0.090s]

writing 'fsg'...

OKAY [ 5.283s]

finished. total time: 5.393s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe erase cache

erasing 'cache'...

OKAY [ 0.360s]

finished. total time: 0.370s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe erase userdata

erasing 'userdata'...

OKAY [ 3.802s]

finished. total time: 3.812s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>mfastboot.exe oem lock

...

(bootloader) sst lock failure!

OKAY [ 0.760s]

finished. total time: 0.760s

C:\Users\Bharat\Downloads\MOTO_G_RECOVERY>

What i want ?

A perfect solution... ASAP (To lock the bootloader, unroot the device, and return to the stock rom) Please help me... :crying::crying:

Device UNLOCKED, status code: 3

Thanks..