Telegram

A COMPREHENSIVE GUIDE TO UNLOCK THE BOOTLOADER ON ONEPLUS PHONES AND RELOCK IT

A Comprehensive Guide to Unlock the Bootloader on OnePlus Phones and Relock it

At Magisk Modules, we provide the most authoritative resources for Android enthusiasts seeking to customize their devices. This detailed guide covers the complete procedure for unlocking and relocking the bootloader on any OnePlus smartphone. Whether you own the latest OnePlus 12 or a legacy device like the OnePlus 3, the core principles remain consistent. Unlocking the bootloader is the gateway to rooting with Magisk, installing custom recoveries like TWRP, and flashing custom ROMs. However, this process carries significant risks, including voiding your warranty and potential data loss. We will navigate these complexities step-by-step, ensuring you have the knowledge to proceed safely.

Understanding the Bootloader and its Impact on OnePlus Devices

The bootloader is the first program that executes when your OnePlus device powers on. It initializes the hardware and loads the operating system kernel. By default, OnePlus devices ship with a locked bootloader to ensure the integrity of the OS and protect user data from malicious modifications. When you unlock the bootloader, you disable these security checks, allowing unsigned code to run.

Why Unlock the Bootloader?

Unlocking is essential for advanced Android customization. It is the prerequisite for:

Risks and Considerations

Before proceeding, understand the consequences:

  1. Warranty Void: Unlocking typically voids the manufacturer’s warranty. OnePlus generally honors warranty claims for software issues unless hardware damage is evident, but proceed with caution.
  2. Data Loss: The unlocking process requires a factory reset. We will guide you to back up your data effectively.
  3. Security Vulnerabilities: An unlocked bootloader lowers the device’s security model. Malicious apps with root access can cause severe damage.
  4. SafetyNet & Banking Apps: Unlocking trips Google’s SafetyNet, preventing banking apps and Netflix from functioning normally. We will discuss how to mitigate this later using Magisk.

Prerequisites for Unlocking the OnePlus Bootloader

Preparation is critical to avoid bricking your device. Ensure you have the following ready before starting the process.

Essential Hardware and Software

Backup Your Data

The unlocking process wipes all personal data. We recommend using:

Enable Developer Options and OEM Unlocking

This is a mandatory step to allow the bootloader to be unlocked.

  1. Navigate to Settings > About Phone.
  2. Tap on Build Number seven times until you see the message “You are now a developer!”
  3. Go back to Settings > System > Developer Options.
  4. Scroll down and enable OEM Unlocking.
  5. Enable USB Debugging. This allows your PC to communicate with the device via ADB.

Install OnePlus USB Drivers (Windows Only)

For Windows users, proper drivers are essential to recognize the device in Fastboot mode.

  1. Download the latest OnePlus USB Drivers from the official OnePlus support site or trusted sources.
  2. Install the drivers.
  3. Connect your phone to the PC. If prompted, allow USB debugging access.

Download ADB and Fastboot Tools

You need the Android Platform Tools to execute commands.

  1. Download the latest version for your OS (Windows, macOS, or Linux) from the official Android developer website.
  2. Extract the zip file to a convenient location (e.g., C:\platform-tools).
  3. Add this folder to your system’s PATH environment variable for easy access from any terminal location.

Step-by-Step Guide to Unlock the Bootloader on OnePlus Phones

Follow these instructions meticulously. We are using the standard fastboot method, which is universally supported across all OnePlus models.

Step 1: Connect Device to PC

  1. Connect your OnePlus phone to the PC using the USB cable.
  2. Open the command prompt (Windows) or terminal (Mac/Linux).
  3. Navigate to your ADB platform-tools folder. You can do this by typing cd C:\platform-tools (or your specific path).
  4. Verify the connection by typing:
    adb devices
    
  5. Your phone will display a prompt asking to allow USB debugging. Check “Always allow” and tap OK.
  6. The command prompt should list your device serial number. If not, reinstall drivers or try a different USB port.

Step 2: Reboot into Bootloader Mode

  1. Once the device is recognized, enter the bootloader (Fastboot) mode using the following command:
    adb reboot bootloader
    
  2. The phone will turn off and reboot into a black screen with white text, indicating Fastboot mode.
  3. Verify the connection in Fastboot mode by typing:
    fastboot devices
    
  4. If your device serial number appears, you are ready to proceed.

Step 3: The Unlocking Command

Warning: This step will wipe all data on your device.

  1. Execute the unlock command. The syntax varies slightly by device, but for most OnePlus phones (including the 6T, 7 Pro, 8T, 9R, 10 Pro, and 11), the command is:
    fastboot oem unlock
    
    Note: On older devices like the OnePlus One or 2, you might need fastboot oem unlock-go.
  2. On the phone screen, you will see a warning message about data loss. Use the Volume Up/Down keys to select UNLOCK THE BOOTLOADER (usually the top option) and press the Power button to confirm.

Step 4: Completion and First Boot

  1. The process takes a few minutes. The terminal on your PC will show the progress (erasing user data, flashing images).
  2. Once finished, the phone will automatically reboot. This first boot is slow (can take up to 10-15 minutes) as the OS rebuilds the Dalvik/ART cache.
  3. You will see the “Unlocked” warning text at the bottom of the screen during boot. This confirms the bootloader is successfully unlocked.

Step 5: Re-Enable Developer Options

After the setup wizard (which you must complete to access the phone), repeat the steps to enable Developer Options and USB Debugging. You will likely need to do this again as settings are wiped.

Advanced: Rooting Your OnePlus Device with Magisk

Now that the bootloader is unlocked, the next logical step for many users is rooting. At Magisk Modules, we specialize in providing modules that enhance functionality.

Extracting the Boot Image

  1. Download the official firmware for your specific OnePlus model and OxygenOS version from the official OnePlus repository.
  2. Extract the payload.bin file (using a tool like payload-dumper-go) to find the boot.img or init_boot.img (for Android 13+ devices).
  3. Transfer the boot.img to your phone’s internal storage.

Patching with Magisk

  1. Install the latest Magisk App (APK) from the official GitHub repository.
  2. Open Magisk, tap Install > Select and Patch a File.
  3. Choose the boot.img you transferred.
  4. Magisk will create a patched file (usually named magisk_patched[_random].img) in your Downloads folder.

Flashing the Patched Image

  1. Transfer the patched image back to your PC (into the platform-tools folder).
  2. Reboot your device to Fastboot mode:
    adb reboot bootloader
    
  3. Flash the patched boot image:
    fastboot flash boot magisk_patched.img
    
    Note: On devices using Dynamic Partitions (OnePlus 8 and newer), you may need to flash to specific slots or use fastboot flash init_boot magisk_patched.img if available.
  4. Reboot the system:
    fastboot reboot
    
  5. Open the Magisk App. If “Installed” shows a version number, rooting was successful.

How to Relock the Bootloader on OnePlus Phones

Relocking the bootloader is sometimes necessary to pass SafetyNet for banking apps or to return the device to stock for sale. Extreme caution is required here. Relocking a bootloader with a modified system (like a custom ROM or root) can hard-brick your device.

Prerequisites for Relocking

  1. Stock Firmware: You must be running the exact stock OxygenOS firmware intended for your device model. Do not attempt to relock while on a custom ROM.
  2. Unrooted: Remove Magisk by flashing the stock boot.img (the original one you saved before patching).
  3. OEM Unlocking Enabled: Ensure you still have Developer Options enabled.

Step 1: Return to Stock (If Modified)

If you have Magisk or a custom recovery installed:

  1. Download the full stock OTA zip for your device.
  2. If you have TWRP installed, flash the stock OTA zip or manually flash the boot.img, system.img, etc., via Fastboot.
  3. Ensure the device boots normally without root.

Step 2: The Relocking Command

  1. Reboot to Fastboot mode:
    adb reboot bootloader
    
  2. Verify the connection:
    fastboot devices
    
  3. Execute the relock command. For most OnePlus devices, the command is:
    fastboot oem lock
    
  4. On the device screen, a warning will appear. Use the volume keys to select LOCK THE BOOTLOADER and confirm with the power button.

Step 3: Factory Reset and Verification

  1. The device will wipe data again and reboot.
  2. During the boot animation, check for the “Locked” message. The “Unlocked” warning text should no longer appear.
  3. Once booted, go to Settings > About Phone > Status. The bootloader status should reflect that it is locked (though this is not always explicitly listed in UI, the boot warning is the key indicator).
  4. Run fastboot oem device-info in the terminal to see detailed bootloader lock status.

Troubleshooting Common OnePlus Bootloader Issues

Even with a clear guide, issues can arise. We address the most frequent problems encountered by users.

“Waiting for Device” in Fastboot

If the PC does not recognize the device in Fastboot mode:

Error: “Failed to Unlock” or “Critical Partition Unlock Required”

Some newer OnePlus models (like the 9 and 10 series) have a separate “Critical” partition.

  1. First, unlock the bootloader as described above.
  2. Reboot to Fastboot and run:
    fastboot flashing unlock_critical
    
  3. Confirm the unlock on the device screen.

Device Stuck in Bootloop After Unlock

If the device loops endlessly after unlocking:

  1. Do not panic. Reboot to Fastboot mode (Power + Vol Up usually).
  2. Flash the stock boot.img for your specific device:
    fastboot flash boot boot.img
    
  3. If the system partition is corrupted, use the MSM Download Tool (for older Qualcomm-based OnePlus devices) to restore the phone to factory stock.

SafetyNet and Play Integrity Failures

After unlocking and rooting, banking apps may not work.

Maintaining System Integrity and Security

We advise maintaining a disciplined workflow when managing a device with an unlocked bootloader.

Regular Backups (Nandroid)

Before flashing any module from our repository or updating OxygenOS, use TWRP or a custom recovery to create a full Nandroid backup. This saves the exact state of your partitions and allows a instant restore if something goes wrong.

Managing OTA Updates

With a unlocked bootloader and Magisk, standard OTA updates will fail or remove root.

  1. Do not accept the standard OTA prompt immediately.
  2. Download the full OTA zip from OnePlus.
  3. If rooted, use the Magisk Module “OTA Keeper” or the classic method: restore the original boot.img, update via OTA, then re-patch and flash the new boot image.

Verifying Firmware Authenticity

Always download OxygenOS firmware from official sources (OnePlus community forums or the official OTA servers). Flashing unsigned or modified firmware on an unlocked bootloader is safe, but flashing incorrect firmware on a locked bootloader will cause a hard brick.

Conclusion

Unlocking and relocking the bootloader on a OnePlus phone gives you complete control over your device’s software environment. While the process involves risks, following this guide ensures a smooth transition between stock and modified states. At Magisk Modules, we support this journey by providing the essential tools and modules required to enhance your Android experience. Whether you seek the raw power of a rooted device or the stability of a stock OS, managing your bootloader is the fundamental skill every Android power user must master. Always proceed with caution, verify your file hashes, and maintain backups to enjoy the best of both worlds.

Explore More
Redirecting in 20 seconds...