How to Relock Bootloader via Fastboot on Android

Bootloader Unlock Fastboot

Although having an unlocked bootloader is useful in many ways like flashing firmware (factory images), installing TWRP and getting root, but it can also lead to blocked services on your device due to security reasons, and hence you might want to relock bootloader to avail those services.

Earlier today, Google released an update to SafetyNet which now also considers a device’s bootloader unlock status to trigger SafetyNet and disable certain services, like Android Pay.

Thankfully though, relocking the bootloader will solve the issue for you. But (of course) you’ll lose all the benefits that come with having an unlocked bootloader on your device.

The fastboot commands to relock bootloader aren’t the same for all devices, so we’ve put together a list of all known Fastboot commands that you can use to relock bootloader on your device in the instructions below.

First things first, make sure you have all the resources listed below to successfully lock the Bootloader on your mobile device.

Things you will need

  • Latest Stock Recovery and ROM for your device by your OEM.
  • Install ADB and Fastboot set up on your PC.
  • Custom Recovery installed on your mobile device.

What you should keep in mind

Relocking the bootloader can not be undone on many devices especially phones manufactured by Xiaomi. Many users that have relocked their bootloader upon unlocking were unable to re-unlock it using any available method. Hence make sure that you want to go back to stock ROM and would not like to install a Custom ROM anytime in the future.

Also, relocking the bootloader will delete all your data and files so make sure to backup your data before proceeding with this guide.

Note: While this method works for most Android devices even if they are running OEM skins, there is a slight chance that additional steps might be required depending on your manufacturer.

This is especially the case with Chinese manufacturers like Xiaomi that have unlocking linked to their cloud backup service of Mi Account. You should check the XDA page for your device to check for any additional steps that might be required for you before proceeding with the guide below.

How to Relock Bootloader via Fastboot

    1. Download the Stock ROM and Recovery on the local storage of your device.
    2. Reboot your device into the custom recovery installed on your device and flash the Stock ROM and recovery.
      Note: Many manufacturers bundle stock recovery along with their latest firmware nowadays. Depending on your manufacturer you might have a single .zip file or two .zip files. If you have two of them, ensure to install the ROM before the recovery or you could brick your device.
    3. Once both utilities are flashed, your device should reboot with the Stock recovery and ROM installed. Confirm that the stock recovery is working as intended by rebooting your device while holding the ‘Volume Up’ button.
      Note: While most stock Android phones use the Volume Up button to boot into recovery mode, the procedure could be different for your mobile device. A quick web search will help you find the right key combination to boot your device into the recovery mode.
    4. Once you are in the recovery mode, you should see your stock recovery options and UI. This means that the Recovery was flashed correctly. Now reboot your device and boot into the fastboot mode for your device.
      Note: Fastboot mode can be accessed by holding down the ‘Volume Down’ button on most devices while rebooting. If this does not work for you, a quick web search will help you identify the right key combination for your device.
    5. Now that your device has booted into the recovery mode, connect it to your PC and open Command Prompt in the ADB directory for your system.
    6. Type in ‘Fastboot devices’ and confirm that your device is being recognized by your system.
    7. Now issue the following command to relock the bootloader.
      fastboot oem lock
      
      OR
      
      fastboot flashing lock

      relock bootloader commandNote: For devices released in 2015 or later, use the ‘fastboot flashing lock’ command. Although, the first command given above may work too.

    8. You should now get a prompt for locking your bootloader on your device. Confirm your selection and wait for the process to complete.
      Note: Do not disconnect your device during this process and ensure that there are no interruptions during this process. Any glitch or power outage during this process can brick your device. 
    9. Once the process completes, your device’s bootloader should be locked and you should be running your stock ROM and recovery. You will now also be eligible for OTA updates from your manufacturer.

That’s all. If you’ve any suggestions to add to this page, let us know in the comments section below.

Posted by
Shivam Malani

Shivam is our resident designer and web developer who also enjoys writing. He loves to meditate, drive on the freeways and hunt for snipers during his Call Of Duty playtime. Email: [email protected]

76 Comments

  1. This will wipe all data and do a factory reset on most phones. Use with caution.

  2. This will wipe all data and do a factory reset on most phones. Use with caution.

  3. This will wipe all data and do a factory reset on most phones. Use with caution.

  4. This will wipe all data and do a factory reset on most phones. Use with caution.

  5. After re locking boot loaders can I get OTA update manually.????????if it gets plz message me in whatsapp or normalmy massage number is 9581846269 thanks………..

  6. After re locking boot loaders can I get OTA update manually.????????if it gets plz message me in whatsapp or normalmy massage number is 9581846269 thanks………..

  7. After re locking boot loaders can I get OTA update manually.????????if it gets plz message me in whatsapp or normalmy massage number is 9581846269 thanks………..

  8. After re locking boot loaders can I get OTA update manually.????????if it gets plz message me in whatsapp or normalmy massage number is 9581846269 thanks………..

  9. If any one works… IF??

  10. If any one works… IF??

  11. If any one works… IF??

  12. If any one works… IF??

  13. hey it didnt work

  14. hey it didnt work

  15. hey it didnt work

  16. Do I need stock recovery?

  17. Do I need stock recovery?

  18. Do I need stock recovery?

  19. Hey bro when i use the second command fastboot flashing lock my phone shows a yellow bootloader warning. Why I do for remove it. Please help!

  20. Hey bro when i use the second command fastboot flashing lock my phone shows a yellow bootloader warning. Why I do for remove it. Please help!

  21. Hey bro when i use the second command fastboot flashing lock my phone shows a yellow bootloader warning. Why I do for remove it. Please help!

  22. Will this work on huawei p9 plus, and do I need stock recovery?

  23. Will this work on huawei p9 plus, and do I need stock recovery?

  24. Will this work on huawei p9 plus, and do I need stock recovery?

  25. Um yeah, this bricked my phone soooo I’m not extremely happy right now. Can’t boot into recovery, just flashes on. Considering I don’t see a warning I feel like I should hold you accountable.

    1. did you ever find a solution? mine is bricked as well. only boots to bootloader screen. can’t get to recovery or anything else.

  26. Um yeah, this bricked my phone soooo I’m not extremely happy right now. Can’t boot into recovery, just flashes on. Considering I don’t see a warning I feel like I should hold you accountable.

    1. did you ever find a solution? mine is bricked as well. only boots to bootloader screen. can’t get to recovery or anything else.

  27. C:adb>fastboot devices
    W3D7N15630001234 fastboot

    C:adb>fastboot oem lock

    FAILED (remote: Command not allowed)
    finished. total time: 0.006s

  28. C:adb>fastboot devices
    W3D7N15630001234 fastboot

    C:adb>fastboot oem lock

    FAILED (remote: Command not allowed)
    finished. total time: 0.006s

  29. Thanks for this. Worked using command ‘fastboot flashing lock’ with command prompt in advanced utilities in the Nexus Root Toolkit for my Nexus 6p. The OEM Lock button in the toolkit didn’t work so I had to find this!

  30. Garrett Southworth

    Thanks for this. Worked using command ‘fastboot flashing lock’ with command prompt in advanced utilities in the Nexus Root Toolkit for my Nexus 6p. The OEM Lock button in the toolkit didn’t work so I had to find this!

  31. [email protected] OP5]# fastboot oem lock

    FAILED (remote: Flashing Lock is not allowed
    )
    finished. total time: 0.000s

  32. [email protected] OP5]# fastboot oem lock

    FAILED (remote: Flashing Lock is not allowed
    )
    finished. total time: 0.000s

  33. It helped for me. But I had to enable USB-debugging under developer options. Also it should be original bootloader and firmware to make it possible to lock bootloader
    I also find helpful
    >> fastboot oem device-info
    to see if device’ bootloader is locked

    And, finally
    >> fastboot oem lock
    this was enough to make device’ bootloader locked

    Now android pay launched without errors related to security reasons

  34. It helped for me. But I had to enable USB-debugging under developer options. Also it should be original bootloader and firmware to make it possible to lock bootloader
    I also find helpful
    >> fastboot oem device-info
    to see if device’ bootloader is locked

    And, finally
    >> fastboot oem lock
    this was enough to make device’ bootloader locked

    Now android pay launched without errors related to security reasons

  35. didn’t work it says that

    1. use “fastboot oem relock (your phone’s unlock code)” and select yes with volume buttons & power

      example: “fastboot oem relock 020957123” and select yes with the volume buttons & the power button

      i used this method on Moto G ,Honor 8 Lite, Redmi Note 3 & Glaxy Note II and its working!

      therefore please know that i am not responsible if something happens to your phone.

    2. what do you mean by “Unlock Code” ?? where do i get it from??

    3. Depends on who your phone’s manufactorer is. eg: huawei/samsung etc.

  36. didn’t work it says that

    1. use “fastboot oem relock (your phone’s unlock code)” and select yes with volume buttons & power

      example: “fastboot oem relock 020957123” and select yes with the volume buttons & the power button

      i used this method on Moto G ,Honor 8 Lite, Redmi Note 3 & Galaxy Note II and its working!

      therefore please know that i am not responsible if something happens to your phone.

      1. what do you mean by “Unlock Code” ?? where do i get it from??

        1. Depends on who your phone’s manufactorer is. eg: huawei/samsung etc.

        2. depending on the devices manufacturer (google, huawei, alcatel, etc.) you may not need a code and only need to type “fastboot oem lock”

      2. Thank you very much indeed. After weeks of trying to relock my Huawei Mate 9 with no luck, I decided to try the method you’d described here ie example: “fastboot oem relock 020957123”. This method worked like a charm. Thanks again.

  37. I so needed this thank you i unlocked the bootloader on my huawei honor 8 lite and forgot to backup my data and i was wondering what to do and i thought of relocking it and so here i am.

  38. I so needed this thank you i unlocked the bootloader on my huawei honor 8 lite and forgot to backup my data and i was wondering what to do and i thought of relocking it and so here i am.

  39. Um, maybe add that relocking the bootloader will factory reset the phone.

  40. Um, maybe add that relocking the bootloader will factory reset the phone.

    1. So does Unlocking … NO BIG DEAL!!

  41. Whenever i get to the 4th step and type in a command, it just says “waiting for device” and does nothing, this is with all 3 commands

    1. you need to put the device into fastboot mode.

    2. If you’re using linux or mac, try to run the command as root/superuser with sudo

  42. Whenever i get to the 4th step and type in a command, it just says “waiting for device” and does nothing, this is with all 3 commands

    1. Then, you are not in Fastboot Mode or your PC doesn’t have the right drivers for fastboot installed.

  43. how to relock oem bootloader in lenovo k8 note
    please reply

  44. its not rebooting, after the process. have any ideas?

  45. for me it still shows up as locked, any ideas on how to fix this???

  46. it just go 99% and stay it…

  47. fuck u!!!deleted all my data bcz of this crup

    1. Stupid I*****. This is exactly what OEM Lock/Relock does, maybe you should read what your phones display says before hitting “OK”.

  48. D:SoftwareMinimal ADB and Fastboot>fastboot oem relock

    FAILED (remote: unknown command)
    finished. total time: 0.004s

    i tried all commands but didnt work anymore:(
    my device: ASUS ZEnfone 3 Laser ZC551KL

    1. In the command window, type only this (fastboot oem lock) and hit enter key.

  49. So I can use my warranty back after doing this?

  50. Whenever i get to the 4th step and type in a command, it just says “waiting for device” and does nothing, this is with all 3 commands

  51. Um, maybe add that relocking the bootloader will factory reset the phone.

  52. I so needed this thank you i unlocked the bootloader on my huawei honor 8 lite and forgot to backup my data and i was wondering what to do and i thought of relocking it and so here i am.

  53. didn’t work it says that

  54. It helped for me. But I had to enable USB-debugging under developer options. Also it should be original bootloader and firmware to make it possible to lock bootloader
    I also find helpful
    >> fastboot oem device-info
    to see if device’ bootloader is locked

    And, finally
    >> fastboot oem lock
    this was enough to make device’ bootloader locked

    Now android pay launched without errors related to security reasons

  55. [email protected] OP5]# fastboot oem lock

    FAILED (remote: Flashing Lock is not allowed
    )
    finished. total time: 0.000s

  56. Thanks for this. Worked using command ‘fastboot flashing lock’ with command prompt in advanced utilities in the Nexus Root Toolkit for my Nexus 6p. The OEM Lock button in the toolkit didn’t work so I had to find this!

  57. C:adb>fastboot devices
    W3D7N15630001234 fastboot

    C:adb>fastboot oem lock

    FAILED (remote: Command not allowed)
    finished. total time: 0.006s

  58. Um yeah, this bricked my phone soooo I’m not extremely happy right now. Can’t boot into recovery, just flashes on. Considering I don’t see a warning I feel like I should hold you accountable.

  59. Thanks. “fastboot oem lock” works with Pocophone F1.

Leave a Reply

Your email address will not be published. Required fields are marked *