OnePlus 6 Relock Bootloader

How to Lock the Bootloader of the Pixel 2 and the Pixel 2 XL

If you’re done experimenting with mods, you can follow this tutorial for instructions on how to lock the bootloader of the Pixel 2 and Pixel 2 XL.

Yesterday I showed you how to unlock the bootloader of the Pixel 2 and the Pixel 2 XL. This is required if you ever want to install any modifications like a custom recovery, custom kernel, custom ROM or even to just gain root access to the device. However, this process trips a security check from Google called SafetyNet and that means that some applications could stop working including Android Pay, Netflix your banking applications and others.

Granted, there are generally ways around that (I like using Magisk), but it is a cat and mouse game that could leave you waiting for an update at any time. So, for those who are tired of using or experimenting with modifications, you can flash the factory stock images and then relock the bootloader of the Pixel 2 and the Pixel 2 XL to put things back to normal. I recommend flashing the stock images before doing this but as long as you’re 100% sure that everything is stock then it isn’t required.

Note – Just like with unlocking the bootloader, this process will perform a factory reset on your Pixel 2 and Pixel 2 XL. Also, do not lock the bootloader if you have a custom recovery, custom ROM, custom kernel or any other system/system modifications installed.


In order to complete the tutorial below, you're going to need some things set up ahead of time. Please follow the how to install ADB and Fastboot tools guide if you haven't done so already. Then you will need to follow the how to enable Developer Mode guide, as well as the tutorial that shows you how to enable USB Debugging Mode.

You will then need to open a command prompt within the within the same folder as your ADB and Fastboot tools and execute the "adb devices" command (without quotes) to start the ADB service. Then connect the device to the PC with a USB cable and you should see the prompt to grant USB Debugging Mode access from the PC the phone is connected to.

Once granted, you can then test this by running the command "adb devices" again (without quotes) in a command prompt or PowerShell to make sure the computer recognizes the device.


 

Pixel 2 Lock Bootloader

  1. Boot the Pixel 2 into Fastboot Mode
  2. Type the following command into the Command Prompt. . .
  3. fastboot flashing lock
  4. . . .then press Enter on the keyboard
  5. Press the Volume Down button on the Pixel 2 to highlight the lock option
  6. And press the Power button to confirm you want to relock the bootloader
  7. Wait for the Pixel 2 to reboot and activate Android
  8. Enable Developer Mode on the Pixel 2 (optional)
  9. Disable OEM Unlock on the Pixel 2 (optional)

This guide above will need to be done on both the Pixel 2 (along with step 6 of the guide below) and the Pixel 2 XL to unlock the bootloader. If you did the unlock_critical command when unlocking the bootloader of the Pixel 2 XL, then you’ll need to continue with the guide below.

Pixel 2 XL lock Bootloader

  1. Boot the Pixel 2 into Fastboot Mode
  2. Type the following command into the Command Prompt. . .
  3. fastboot flashing lock_critical
  4. . . .then press Enter on the keyboard
  5. Press the Volume Down button on the Pixel 2 XL
  6. And press the Power button to confirm you want to relock the Pixel 2 bootloader
  7. Wait for the Pixel 2 to reboot and activate Android again
  8. Enable Developer Mode on the Pixel 2 (optional)
  9. Disable OEM Unlock on the Pixel 2 (optional)

This step by step tutorial is a detailed explanation of a topic I covered on my Pixel 2 Tips and Tricks article. I recommend you read through that if you're curious about learning the ins and outs of the Pixel 2 or Pixel 2 XL.


Explanation

If you followed my Pixel 2 bootloader unlock tutorial then most of this will feel right at home. The process is nearly identical with only a couple of subtle changes. Before you could execute both unlock commands (on the Pixel 2 XL) and be sent back to Fastboot Mode to manually boot back into Android. This time around, each time you confirm you want to lock the bootloader (which will only happen once for the Pixel 2, but may be twice for the Pixel 2 XL), you are instantly forced into a factory reset process.

Since you likely already have ADB and Fastboot tools setup from unlocking the device, you can skip the introductory part of this guide. However, you will definitely need to follow it if you are locking the bootloader on a different computer than before (or if you uninstalled/deleted the stuff from last time). When you’re ready though, you can boot the Pixel 2 or Pixel 2 XL into Fastboot Mode and then turn your attention to the Command Prompt after the USB cable is plugged in.

Pixel 2 Lock Bootloader Critical
If you own the Pixel 2 XL you may need to execute this additional command to full relock the bootloader.

You’ll first want to execute the fastboot flashing lock command and then wait for the Pixel 2 to do its factory reset. This will instantly through you into a restart boot cycle which can take a couple of minutes to complete. Once that is done, activate Android again and if you would like, you can go in and disable the OEM Unlock option within the Developer Options menu (this is optional though). If you are running the Pixel 2 XL and you previously did the unlock_critical command, then you’ll more to do.

If that is the case, go ahead and power off the Pixel 2 XL again so that you can boot it up into Fastboot Mode. Once there, turn your attention back to the Command Prompt and execute the fastboot flashing lock_critical command as shown in the guide above. This will once again force you into a factory reset process and then reboot you back into the Android activation screen after a few minutes. You can follow along with me in the video if you’d like.

Just like before, once you’re back into Android you can choose to disable the OEM Unlock option if you would like (but again, it’s not required).


If this tutorial helped you in any way, please consider donating via PayPalPatreon, or GoFundMe. If you can't afford to donate then sharing this on social networks such as Facebook, Twitter, etc. will also help a lot.


 

5 thoughts on “How to Lock the Bootloader of the Pixel 2 and the Pixel 2 XL”

  1. Hi bro, I have a Pixel 2 XL, in order to get a real immersive mode (hide navbar completely via Magisk module). I’ve followed your post about “How to Gain Systemless Root Access to the Pixel 2 and Pixel 2 XL”. Now my question is, after root systemlessly, should I or do I need to re-lock my bootloader again? If so, will I lost such kind of systemless root? That would be a great appreciate if you could help to answer, thanks in advance!

    1. No, you should not relock the bootloader. The only time you ever want to relock the bootloader is after you flash everything back to stock Android (using Google’s flash-all.bat file).

  2. after i flashed the original kernel back on using boot_a and boot_b command i followed this tutorial the relock my bootloader. it says locked but underneath has a yellow error saying image auth failure. so i unlocked it again and shows no error. im on the pixel 2. any suggestions as to what would cause the error?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.