![]()
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:
- Rooting: Gaining superuser access to modify system files. We host a vast collection of Magisk Modules in our Magisk Module Repository designed specifically for rooted devices.
- Custom ROMs: Installing community-developed firmware like LineageOS for a stock Android experience or added features.
- Custom Kernels: Flashing kernels to overclock the CPU, improve battery life, or enable specific hardware features.
- Full Backups: Using tools like Swift Backup (requires root) or ADB backups without restriction.
Risks and Considerations
Before proceeding, understand the consequences:
- 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.
- Data Loss: The unlocking process requires a factory reset. We will guide you to back up your data effectively.
- Security Vulnerabilities: An unlocked bootloader lowers the device’s security model. Malicious apps with root access can cause severe damage.
- 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
- OnePlus Device: Ensure the battery is charged above 60% to prevent shutdowns during critical operations.
- Windows, Mac, or Linux PC: We will use ADB (Android Debug Bridge) and Fastboot tools.
- USB Cable: A high-quality data cable to ensure a stable connection.
- Internet Connection: Required for downloading drivers and tools.
Backup Your Data
The unlocking process wipes all personal data. We recommend using:
- Google Backup: For contacts, photos (via Google Photos), and app data.
- Local Backup: Transfer music, documents, and APK files to a PC or external storage.
- SMS/Call Logs: Use apps like SMS Backup & Restore.
Enable Developer Options and OEM Unlocking
This is a mandatory step to allow the bootloader to be unlocked.
- Navigate to Settings > About Phone.
- Tap on Build Number seven times until you see the message “You are now a developer!”
- Go back to Settings > System > Developer Options.
- Scroll down and enable OEM Unlocking.
- 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.
- Download the latest OnePlus USB Drivers from the official OnePlus support site or trusted sources.
- Install the drivers.
- 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.
- Download the latest version for your OS (Windows, macOS, or Linux) from the official Android developer website.
- Extract the zip file to a convenient location (e.g.,
C:\platform-tools). - 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
- Connect your OnePlus phone to the PC using the USB cable.
- Open the command prompt (Windows) or terminal (Mac/Linux).
- Navigate to your ADB platform-tools folder. You can do this by typing
cd C:\platform-tools(or your specific path). - Verify the connection by typing:
adb devices - Your phone will display a prompt asking to allow USB debugging. Check “Always allow” and tap OK.
- 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
- Once the device is recognized, enter the bootloader (Fastboot) mode using the following command:
adb reboot bootloader - The phone will turn off and reboot into a black screen with white text, indicating Fastboot mode.
- Verify the connection in Fastboot mode by typing:
fastboot devices - 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.
- 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:Note: On older devices like the OnePlus One or 2, you might need
fastboot oem unlockfastboot oem unlock-go. - 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
- The process takes a few minutes. The terminal on your PC will show the progress (erasing user data, flashing images).
- 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.
- 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
- Download the official firmware for your specific OnePlus model and OxygenOS version from the official OnePlus repository.
- Extract the payload.bin file (using a tool like payload-dumper-go) to find the
boot.imgorinit_boot.img(for Android 13+ devices). - Transfer the
boot.imgto your phone’s internal storage.
Patching with Magisk
- Install the latest Magisk App (APK) from the official GitHub repository.
- Open Magisk, tap Install > Select and Patch a File.
- Choose the
boot.imgyou transferred. - Magisk will create a patched file (usually named
magisk_patched[_random].img) in your Downloads folder.
Flashing the Patched Image
- Transfer the patched image back to your PC (into the platform-tools folder).
- Reboot your device to Fastboot mode:
adb reboot bootloader - Flash the patched boot image:Note: On devices using Dynamic Partitions (OnePlus 8 and newer), you may need to flash to specific slots or use
fastboot flash boot magisk_patched.imgfastboot flash init_boot magisk_patched.imgif available. - Reboot the system:
fastboot reboot - 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
- 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.
- Unrooted: Remove Magisk by flashing the stock
boot.img(the original one you saved before patching). - 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:
- Download the full stock OTA zip for your device.
- If you have TWRP installed, flash the stock OTA zip or manually flash the
boot.img,system.img, etc., via Fastboot. - Ensure the device boots normally without root.
Step 2: The Relocking Command
- Reboot to Fastboot mode:
adb reboot bootloader - Verify the connection:
fastboot devices - Execute the relock command. For most OnePlus devices, the command is:
fastboot oem lock - 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
- The device will wipe data again and reboot.
- During the boot animation, check for the “Locked” message. The “Unlocked” warning text should no longer appear.
- 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). - Run
fastboot oem device-infoin 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:
- Driver Issues: Open Device Manager on Windows. If the device appears with a yellow exclamation mark, manually update the driver. Point it to the
usb_driverfolder included in the OnePlus driver package or the generic Google USB driver. - Cable/Port: Try a different USB 2.0 port (USB 3.0 can sometimes cause issues with Fastboot) and a high-quality data cable.
Error: “Failed to Unlock” or “Critical Partition Unlock Required”
Some newer OnePlus models (like the 9 and 10 series) have a separate “Critical” partition.
- First, unlock the bootloader as described above.
- Reboot to Fastboot and run:
fastboot flashing unlock_critical - Confirm the unlock on the device screen.
Device Stuck in Bootloop After Unlock
If the device loops endlessly after unlocking:
- Do not panic. Reboot to Fastboot mode (Power + Vol Up usually).
- Flash the stock
boot.imgfor your specific device:fastboot flash boot boot.img - 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.
- Solution: Use Magisk with the MagiskHide feature (or the newer Zygisk and DenyList). Enable Enforce DenyList for specific apps.
- Universal SafetyNet Fix: Install the “Universal SafetyNet Fix” module from the Magisk Module Repository at Magisk Modules. This spoofs the device certification.
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.
- Do not accept the standard OTA prompt immediately.
- Download the full OTA zip from OnePlus.
- 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.