• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[Guide]Un/locking Motorola Bootloader

Search This thread

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
UnLocking and ReLocking Motorola Bootloader

Note:
Moto Site is finicky, and instead of it saying I'm sorry there's an error, it just says​
"Your device does not qualify for bootloader unlocking."​
So if you get this notice but you have a qualifying Cid (see post #3)​
try again later.​

Carrier exclusive models (ex. Verizon, AT&T, Tracfone) are almost never unlockable.​
Bootloader unlock codes are not available for Amazon Branded devices​


Warnings
My warning: If you unlock the bootloader.​
Don't expect that it can be relocked.​
There are many people that have Unlocked the bootloader.​
Only to find out that it will not relock.​
Or if it Locks it has a warning​

or​



Read the warnings on the Offical Unlocking site.​
 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
UnLocking the Bootloader

There is an Offical list of Devices that can be Unlocked, but it has never been kept up to date.​
If you want to know if your device can be Unlock, you need to go through the process to find out.​

You need to setup ADB/Fastboot on another device (Win/Linux/Mac/Chromebook)
[Index] Setting up and Using ADB/Fastboot

Follow the directions on the Official Motorola Bootloader Unlocker Site

Be careful not to remove part of the unlock key, when removing the junk, spaces and extra lines.
Paste it into data scrub tool: https://support.motorola.com/us/en/dataScrubTool

Motorola will email you a key.
Use that key like this.
Code:
fastboot oem unlock UNIQUE_KEY
 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Can My Bootloader Be UnLocked?

Carrier exclusive models (ex. Verizon, AT&T, Tracfone) are almost never unlockable.​
Bootloader unlock codes are not available for Amazon Branded devices​



Older: Sunshine method

There is an Unofficial method using an app called Sunshine.
 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Locking Motorola Bootloader
  • Relocking Motorola Bootloaders can be difficult.
  • Don't relock the bootloader if it was unlocked by any other method than Offical.
  • ReFlash Stock Firmware, Factory Reset, Reboot. and make sure everything is working correctly before relocking.

Current locking instructions - 27 April 2021

If the device was rooted, reflash stock firmware.
Your device likely uses fastbootd
[Guide] Flashing Motorola Firmware
After flashing Firmware, power up the phone to make sure it will boot.
If it starts up ok
return to bootloader and run
Code:
fastboot oem lock
Follow the instructions in your terminal's output.
You should see something like "signed system image required" which means you have to
Flash all system.img_sparsechunk.X parts a second time.
When finished run the lock command again and follow the instructions in your output line.
Continue until your bootloader is locked.



Other methods that have worked in the past


Run
Code:
fastboot devices
fastboot oem lock
fastboot oem lock
fastboot reboot bootloader
Check if bootloader says
Code:
flashing_locked
If the bootloader doesn't lock

You may need to try something like.
Code:
fastboot oem lock begin
fastboot oem lock begin
fastboot oem lock
fastboot oem lock
fastboot oem lock
fastboot flash boot boot.img
fastboot oem lock

or

Code:
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

I saw the same thing on my end at first. Found this to work repeatedly....
fastboot oem lock (enter this a few times until i says something to the effect of...."you still need to flash a signed boot.img")
fastboot flash boot boot.img (this will now flash fine without saying the image is not signed)
fastboot oem lock (if you prefer to re-lock. You'll need the unlock key again if you plan to unlock).
- https://forum.xda-developers.com/showpost.php?p=79305396&postcount=12


Head on over to https://support.lenovo.com/us/en/downloads/ds101291 and download the tool, after installed put your phone in bootloader/fastboot mode and go through the rescue steps up until the firmware is downloaded, do not click rescue after the firmware is fully downloaded just head on over to C:\ProgramData\LMSA\Download\RomFiles and open the downloaded firmware and take the boot image from there and copy it to your fastboot tools folder and flash that boot.img check that the firmware matches the version installed on your phone before flashing the boot.img.
- https://forum.xda-developers.com/showpost.php?p=79300655&postcount=2


also see



https://forum.xda-developers.com/g5-plus/help/problem-locking-t3801320
flash either stock or a stock-based rom along with Magisk and enable OEM unlock in the dev options and the you should be able to re-lock.
Magisk Hide must be enabled. Only this option hides the unlocked bootloader which results in an active toggle for the OEM Unlock option.

Old
Official Motorola Instructions Page
https://motorola-global-portal.custhelp.com/app/standalone/bootloader/recovery-images
 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Alt UnLocking Method
or
Bypass Email method

You have to remove the hashtags "#" from the code you get from the phone.
Remove the quotes "Part1" from the link below.
Code:
https://support.motorola.com/us/en/api/mse/bootLoaderVerifyPhone?serialNo="Part1"&secSerialNo=&processorUid="part4"&bootloaderHash="Part3"&infoOnly=N

There is a chance this could change with newer devices.
The 1st part should be 16 characters long.
The 4th part should be 32 characters long.
The 3rd part should be 40 characters long.

So, a good unlock code will look like this. Mine is 19 characters long.
Code:
{"status_code":"0000","status_description":"Successful!","Boot_loader_unlock_code":"7*****************B"}

If it cannot be unlocked. It maybe something like.
Code:
{"status_code":"0020","status_description":"Either there are errors in input data or this device does not have bootloader lock code available yet.","Boot_loader_unlock_code":null}

if you see
Code:
{"status_code":"0003","status_description":"Processor UID cannot be empty!","Boot_loader_unlock_code":null}
the link is not correct, try creating the link again.



Credits
 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Just copied from link below

Setting lock/unlock properties​

The ro.oem_unlock_supported property should be set at build time based on whether the device supports flashing unlock.

  • If the device suppports flashing unlock, set ro.oem_unlock_supported to 1.
  • If the device doesn't support flashing unlock, set ro.oem_unlock_supported to 0.
If the device supports flashing unlock, then the bootloader should indicate the lock status by setting the kernel command line variable androidboot.flash.locked to 1 if locked or 0 if unlocked.

For devices that support dm-verity, use ro.boot.verifiedbootstate to set the value of ro.boot.flash.locked to 0; this unlocks the bootloader if the verified boot state is orange.

 
Last edited:

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Is the bootloader Unlocked?

You can check if the bootloader is unlocked with
Code:
fastboot getvar securestate

If you see this the Bootloader is still Locked
Code:
securestate: oem_locked

If you see this the bootloader is UnLocked
Code:
securestate: flashing_unlocked
 

sd_shadow

Recognized Contributor
Sep 21, 2011
17,825
1
8,357
South Dakota
goo.gl
Moto X4
Moto G7 Power
Why is OEM unlocking greyed out/ unavailable?

It's not unusual for OEM unlocking on Moto devices, to be greyed out.
You need to connect to wifi/LTE and it should be available in 3 or so days after that.

1-szare.png


Troubleshooting
If 3 days after connection to the internet and still is greyed out
see
 
Last edited: