Home » OnePlus » OnePlus 5 » How to Lock the Bootloader of the OnePlus 5 and OnePlus 5T
Essential Phone Lock Bootloader

How to Lock the Bootloader of the OnePlus 5 and OnePlus 5T

If you ever find the need and want to relock the bootloader of the OnePlus 5 or OnePlus 5T, then you can follow these quick and easy steps outlined below.

As mentioned yesterday, you’ll want to unlock the bootloader of the OnePlus 5 if you ever want to install any type of modification on your device. This includes everything from a Custom Recovery (TWRP) to a Custom Kernel, a Custom ROM and even just simple UI modifications that have been developed by the community. However, there can be a major downside to unlocking the bootloader thanks to Google’s new SafetyNet checks.

SafeyNet checks are put into place so that the developers of applications such as Android Pay, Pokemon Go, and some banking applications feel their users are not tampering with the operating system. Before, we could have the bootloader unlocked and still use these applications because they didn’t trigger those checks. However, a new update now detects if you have an unlocked bootloader so unless you bypass them (with Magisk, a Custom Kernel, etc.), then you can’t use them with an unlocked bootloader.

If you’re not willing to use one of those bypass solutions (or maybe Google has updated SafetyNet to detect the current bypasses), then you can follow these steps below to lock the bootloader of the OnePlus 5 again. Be aware that this will perform a factory reset on your phone, and you should only do this after you have completely removed any and all root modifications from your device.

Requirement:

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 this guide: How to Enable Developer Mode, as well as this one which shows you How to Enable USB Debugging Mode.

You will then need to open a command prompt within the same folder as your ADB and Fastboot tools and execute the "adb devices" command (without quotes) to start the ADB service. From here, you can connect the device to the PC with a USB cable. If everything has been done properly then you'll be asked if you want 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, Terminal, or Windows PowerShell to make sure the computer recognizes the device.


 

OnePlus 5 Lock Bootloader

  1. Boot the OnePlus 5 into Fastboot Mode
  2. Connect the PC to your OnePlus 5 via a USB cable
  3. Type the following command into the Command Prompt. . .
  4. fastboot flashing lock
  5. . . and press Enter on the keyboard
  6. Press the Volume Down or Volume Up button until the Yes option is highlighted
  7. Press the Power button to confirm and select this option
  8. Wait for the OnePlus 5 to reboot and perform the factory reset
  9. Then wait for the OnePlus 5 to reboot back into the Android OS
  10. Disable the OEM Unlock feature (optional)

Explanation

Since you most likely have already gone through most of these steps to unlock the bootloader, it should all be very familiar to you. I say most likely because sometimes you can buy the OnePlus 5 used from someone, or even from a reseller, and they could have previously unlocked the bootloader. These rare cases are the reason why I have included the ADB/USB Debugging instructions above the guide too, just so everyone is on the same page here.

Once you have all of the initial setup stuff done, you can then boot the OnePlus 5 into Fastboot Mode. Follow the steps in the guide linked for Step 1 if you’re not familiar with how to do this. This is required because to relock the OnePlus 5 or OnePlus 5T bootloader, we need to execute a Fastboot command. Once the OnePlus 5 is in Fastboot Mode (also known as Bootloader Mode), turn your attention to the Command Prompt on the PC and execute the fastboot flashing lock command.

OnePlus 5 Lock Bootloader Confirm
You’ll be asked to confirm if you want to relock the bootloader of the OnePlus 5.

This should make the screen of the OnePlus 5 change and it will ask you if you’re sure you want to lock the bootloader. Proceeding here will wipe all of the data you have on your smartphone so be aware of that before you decide. If you are sure this is what you want, press the Volume Up or Volume Down button until the Yes option is highlighted, and then press the Power button to select that option. The OnePlus 5 will reboot so it can do a factory reset, and then it will reboot again to take you back into the Android OS.

This first boot cycle will take longer than normal so be patient while the OS sets some things back up. You’ll then see the typical Android activation screen and setting up the phone shouldn’t take very long. Once you’re to the Home Screen of the OnePlus 5 or OnePlus 5T, can then proceed to install your applications and games and any backup data you have. You also have the ability to disable the OEM Unlock feature from within the Developer Options menu if you would like.

This last part isn’t required, but it can help keep your device secure from someone else unlocking the bootloader if they got their hands on your phone.


If this tutorial helped you in any way, please consider donating via PayPalPatreon, Cryptocurrency, or GoFundMe. If you can't afford to donate then sharing this on social networks such as Facebook, Twitter, XDA, forums, etc. will also help a lot. I would also appreciate suggestions for Android tips and tutorials that you would like to see in the future.


 

15 thoughts on “How to Lock the Bootloader of the OnePlus 5 and OnePlus 5T”

          1. Yeah I had changed recovery with TWRP and also root my phone now jump back official stock recovery and wanna lock my bootloader

          2. I had already reverted stock recovery, remove root and all else.
            But I’m still getting this same issue “flashing lock is not allowed”

          3. I don’t know. Either you’re missing something that was changed and/or didn’t restore it properly, or you’ll need to wait for an unbrick method comes out (which I will do a write up on)

  1. I don’t understand why to enter “fastboot flashing lock” instead of entering “fastboot oem lock” which is the command for re-locking.

    1. The unlock/lock command used to be fastboot oem lock (or unlock). However, there was an update to ADB that changed this to the new command fastboot flashing lock (or unlock)

      This article explains it nicely
      https://developers.google.com/android/images

      Google says to use the fastboot flashing command unless you’re using an older device. The OnePlus 5/5t definitely isn’t an old device and as the videos how, the fastboot flashing command worked for me.

Leave a Reply

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

Scroll to Top