Unlocking bootloader on a OnePlus device - yashaswee-exe/AndroidGuides GitHub Wiki

Unlocking the bootloader

Caution

  • Unlocking the bootloader erases all data on the phone. Back up everything first & logout of Google accounts.
  • It may affect your warranty, Play Integrity results, and some banking or DRM-dependent apps.
  • With every passing day Google is making fixing integrity difficult.
  • You do this at your own risk. I am not responsible for bricked devices.

1. Enable Developer options

  1. Go to Settings → About device → Version
  2. Tap Build number 7 times
  3. Enter your PIN if asked

2. Enable OEM unlocking and USB debugging

  1. Go to Settings → System → Developer options
  2. Turn on OEM unlocking
  3. Turn on USB debugging

If OEM unlocking is greyed out, connect to Wi-Fi, make sure no work or school account or device-management policy is active, restart, and check again. On some devices it can take a short while to become available.

3. Check that the PC sees the phone

Open a terminal in your platform-tools folder:

adb devices

Accept the Allow USB debugging prompt on the phone. Your device should be listed as device.

4. Reboot into bootloader mode

adb reboot bootloader

Check the connection:

fastboot devices

5. Unlock

fastboot flashing unlock

On the phone, use the volume keys to select Unlock the bootloader and confirm with the power button.

Older OnePlus models (such as the OnePlus 6T and earlier) use this command instead:

fastboot oem unlock

The phone wipes itself and reboots. The first boot can take several minutes.

6. Verify

adb reboot bootloader
fastboot getvar unlocked

The result should say unlocked: yes.



Locking the bootloader

Caution

  • Only re-lock if the phone is running 100% stock, unmodified firmware (stock boot, vendor_boot, recovery, vbmeta and so on).
  • You should have exact same firmware on both slots. (Explained below)
  • Re-locking with a custom ROM, custom recovery, modified boot image or root can leave the phone bricked or stuck in a boot loop.
  • Re-locking also wipes all data. Take a backup, remove any modules if you have and logout of Google accounts.
  • Locking bootloader on CN devices running international firmware will break OTA updates / other drawbacks, check device specific groups.

1. Return to stock

Flash the full official firmware for your exact model and region.

Important

Doing this is necessary even if you have unrooted/ manually flashed all modified partitions because before locking you SHOULD have same firmware on both slots.

You can follow this guide to create fastboot flashable firmware. If your device is not supported, you can instead use FFF Tool.

2. Reboot into bootloader

adb reboot bootloader

3. Lock

fastboot flashing lock

Confirm on the phone with the volume keys and power button.

Older models:

fastboot oem lock

The phone wipes and reboots into setup.

4. Verify

adb reboot bootloader
fastboot getvar unlocked

The result should say unlocked: no.


Troubleshooting

Problem What to try
fastboot devices shows nothing Install or update the USB driver, try another cable or USB port, and use a USB 2.0 port if available
adb devices shows unauthorized Revoke USB debugging authorizations in Developer options, then reconnect and accept the prompt
waiting for any device Phone isn't in fastboot mode, or the driver is missing
FAILED (remote: 'Flashing Unlock is not allowed') OEM unlocking is off, greyed out, or blocked by the carrier
Boot loop after locking You locked with non-stock firmware. Unlock again and flash the full stock ROM, or use EDL/unbrick tools

⚠️ **GitHub.com Fallback** ⚠️