Unlocking bootloader on a OnePlus device - yashaswee-exe/AndroidGuides GitHub Wiki
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.
- Go to Settings → About device → Version
- Tap Build number 7 times
- Enter your PIN if asked
- Go to Settings → System → Developer options
- Turn on OEM unlocking
- 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.
Open a terminal in your platform-tools folder:
adb devicesAccept the Allow USB debugging prompt on the phone. Your device should be listed as device.
adb reboot bootloaderCheck the connection:
fastboot devicesfastboot flashing unlockOn 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.
adb reboot bootloaderfastboot getvar unlocked
The result should say unlocked: yes.
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.
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.
adb reboot bootloaderfastboot flashing lockConfirm on the phone with the volume keys and power button.
Older models:
fastboot oem lock
The phone wipes and reboots into setup.
adb reboot bootloaderfastboot getvar unlocked
The result should say unlocked: no.
| 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 |