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
-
- Download the Stock ROM and Recovery on the local storage of your device.
- 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. - 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. - 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. - 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.
- Type in ‘Fastboot devices’ and confirm that your device is being recognized by your system.
- Now issue the following command to relock the bootloader.
fastboot oem lock OR fastboot flashing lock
Note: For devices released in 2015 or later, use the ‘fastboot flashing lock’ command. Although, the first command given above may work too.
- 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. - 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.
Discussion