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

Pixel 2 Lock Bootloader

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 setup ahead of time. Please follow the how to install ADB and Fastboot tools guide if you haven't done so already. You're also going to need to start the ADB service by executing the "adb devices" command (no quotes) in the Command Prompt. Lastly, you'll need to follow the how to enable Developer Mode guide, as well as the how to enable USB Debugging Mode guide, and make sure to grant USB Debugging access from the PC to your 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 at Patreon or PayPal. If you can't afford to donate then sharing this on social networks such as Facebook, Twitter, etc. will also help a lot.

 

About the author

Doug

I'm working to create an organized and easy to follow central repository of Android tips, tutorials, guides and everything you need to know. With a focus on device specific tutorials now, my goal is to branch out and do more universal tips and tricks that will work on all Android devices.