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.

Dozens of premium Android apps go on sale every single day. Check out the latest over at PlayStoreSales.com.

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.

Before you can complete the tutorial below, you first need to install and enable a few things ahead of time.
– You need ADB & Fastboot tools installed on your PC. I recommend Minimal ADB & Fastboot, but you could just use Android’s SDK Platform Tools which are provided by Google.
 – Next, you will need to enable Android’s Developer Mode on your smartphone.
 – Then, you’ll want to go ahead and enable USB Debugging Mode on the device as well.
 – Don’t forget to make sure your PC can detect the smartphone using the ADB devices command.

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)


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 was helpful, please consider supporting the website in any number of ways.

Donations help a lot, but simply sharing & liking things that have helped or are of interest to you (on places like Reddit, Facebook, YouTube) while following & subscribing to Android Explained accounts on sites like Facebook, YouTube can help too.

If you run into any issues with this guide though, please leave a comment to let me know. This will enable me to keep all Android tutorials as up to date as possible.

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

      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 Comment

Your email address will not be published. Required fields are marked *

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

Scroll to Top