How to Relock Bootloader After Rooting Without Bricking

Prerequisites

Before you begin, make sure you’ve done the following:

Important note: This guide mostly applies to devices like Google Pixel and OnePlus. Make sure to check your device’s specific steps on forums such as XDA.

Relocking the Bootloader Using Stock Firmware

Locking the bootloader after rooting isn’t something you want to rush into. If your device has any changes from the original system—like custom ROMs or tweaks through Magisk—locking the bootloader could break your phone. But if everything is stock, you’re in the clear to proceed.

Checking the Boot Image and Firmware

To start, it’s important to make sure your phone’s boot image and firmware are exactly like they were from the factory. If the boot image was changed for rooting, relocking the bootloader could cause your phone to stop working.

  1. Enter Fastboot Mode:
    Turn off your phone, then hold the Power + Volume Down buttons to enter Fastboot mode. Connect your phone to your computer.
  2. Check the Boot Image:
    Run the following command on your computer:
    fastboot getvar all
    This will show you details about your device. If your boot image has been modified, you’ll need to restore the stock boot image before locking the bootloader.

Flashing Stock Firmware

If your phone has been altered in any way—like with a custom ROM or a modified boot image—you need to go back to stock firmware. This resets everything to the factory settings, making it safe to lock the bootloader.

  1. Download Stock Firmware:
    Find the right factory image for your phone. You can download it from Google Factory Images or OnePlus Stock ROMs.
  2. Flash the Firmware:
    Boot your phone into Fastboot mode. Then, in the command prompt on your computer, enter:
    fastboot flash bootloader bootloader.img
    fastboot flash radio radio.img
    fastboot flash -w update image.zip
  3. Lock the Bootloader:
    After the firmware is flashed, you can lock the bootloader. Enter this command:
    fastboot oem lock
    Follow the prompts on your phone to confirm. It will reboot with the bootloader locked.

Relocking the Bootloader with AVBRoot

Want to keep root access but still lock the bootloader? AVBRoot offers a way to do that. This method is a bit more complicated, so only go this route if you feel comfortable with these steps. AVBRoot allows you to lock the bootloader without losing root, but make sure you fully understand how it works.

Installing AVBRoot

You need to install AVBRoot first, which will allow you to lock the bootloader while keeping root.

  1. Download AVBRoot:
    Grab the AVBRoot file. Double-check that it’s compatible with your phone.
  2. Flash AVBRoot:
    Boot into Fastboot mode, and use the command below to flash AVBRoot:
    fastboot flash avbroot avbroot.img

Locking the Bootloader with AVBRoot

Once AVBRoot is installed, locking the bootloader is similar to the stock method.

  1. Lock the Bootloader:
    In Fastboot mode, type the following:
    fastboot oem lock avb
    Confirm on your device, and your bootloader will now be locked while keeping root access.

Should You Lock the Bootloader After Rooting?

Now that you know how to lock the bootloader after rooting, you might be asking yourself: “Is it worth it?” Well, it depends on your needs. Locking the bootloader does improve security, but it can also prevent you from easily fixing things if something goes wrong. Once locked, it’s much harder to modify or repair your device without starting from scratch.

For most users, it’s usually better to keep the bootloader unlocked after rooting. This gives you more flexibility to make changes or fix issues down the road. Some apps (like banking apps) work better on a locked bootloader, but you can often find workarounds, like using Magisk, to keep them running.

In the end, it’s up to you. If security is your main concern, locking the bootloader could give you peace of mind. But if you like having the freedom to customize and troubleshoot, keeping it unlocked is often the smarter choice.

Think carefully before locking that bootloader. You can’t easily go back once it’s done, and the risks of bricking your phone are real. So, is locking the bootloader after rooting the right move for you? Only you can decide.