OnePlus Root Guide
BEFORE FLASHING
Unlocking erases data. Back up and obtain stock firmware for the exact model, region and installed build. Verify the Magisk image, target partition, slot and recovery method before writing anything. Do not disable verified boot or relock a modified device as a generic fix.
These steps use Magisk. See the KernelSU or APatch guide for their different requirements.
This guide covers Magisk on eligible OnePlus devices running OxygenOS or ColorOS. Unlocking and recovery vary by model, firmware and carrier.
Quick Navigation
Related Guides:
- Main Rooting Guide - Universal rooting concepts
- Bootloader Unlocking - Detailed unlock guide
- Magisk Guide - Complete Magisk documentation
Prerequisites
Critical Requirements
BEFORE YOU START
Data Wipe: Unlocking bootloader erases everything including internal storage.
Backup Everything: Photos, contacts, messages, app data, authenticator codes.
Carrier Variants: Some require an unlock token or additional eligibility checks; verify the exact model.
OEM Unlocking: Must be available in Developer Options. Some T-Mobile models cannot unlock.
Device Compatibility
Most OnePlus devices with unlockable bootloaders can be rooted. Check XDA Forums for your specific model.
INCOMPATIBLE DEVICES
- T-Mobile and some carrier-branded models may have permanently locked bootloaders
- Chinese-market models running ColorOS may have additional restrictions
💡 Locked bootloader? Temporary root exists
On specific OnePlus, OPPO and realme builds, ghostlock-oneplus uses GhostLock (CVE-2026-43499) for session-only root without unlocking the bootloader. A full reboot clears active root, but files and settings changed during the session may remain. Other tools use different exploits and target lists; check the exact model and kernel in the loader's own documentation and the sister project's OnePlus, OPPO and Realme section.
Hardware Requirements
- OnePlus device (any supported model)
- Quality USB-C cable
- Computer (Windows, macOS, or Linux)
- 50%+ battery charge
Software Requirements
On Computer:
Platform Tools (ADB/Fastboot)
- Download: Android Platform Tools
- Extract to easy location
OnePlus USB Drivers (Windows)
- Usually auto-install with ADB
- Or download from OnePlus site
Stock Firmware (for recovery)
- Obtain the exact model, region and installed build, with a verified device-specific restore procedure.
- Oxygen Updater is a third-party update downloader. Its offered package may not match the installed build; verify it before use.
- Check OnePlus Support or a trusted model-specific community source when the required package is unavailable.
On Device:
- Magisk APK
- Download: Magisk GitHub
- Latest stable version
Alternative Root Methods
KernelSU is an alternative when the exact OnePlus model and kernel are supported. It offers per-app root authorization, but neither framework guarantees Play Integrity. See the KernelSU Guide.
- File Manager
- OxygenOS Files app
- Or any from Play Store
Device Preparation
Step 1: Enable Developer Options
- Settings > About device
- Tap "Build number" 7 times
- Enter PIN/password
- "Developer options unlocked" appears
Step 2: Enable Required Settings
Settings > System > Developer options:
- OEM unlocking: Enable (critical)
- USB debugging: Enable
- Advanced reboot: Enable (optional)
Step 3: Verify ADB Connection
adb devices
# Accept USB debugging prompt on device
# Should show device with "device" statusUnlock Bootloader
Confirm the unlock procedure for your exact model and carrier before proceeding.
Step 1: Enter Fastboot Mode
Method 1: ADB Command
adb reboot bootloaderMethod 2: Hardware Keys
Use the bootloader key combination documented for your exact model. For example, LineageOS documents Volume Up + Power for the OnePlus 3T; other models can differ.
Step 2: Verify Fastboot Connection
fastboot devices
# Should show device serial numberStep 3: Unlock Bootloader
Use the command and any unlock-token procedure documented for your exact model and carrier. OnePlus's carrier unlock instructions show that fastboot oem unlock and fastboot flashing unlock apply to different models; do not try them interchangeably. Confirm the prompt on the device. Unlocking wipes data.
Step 4: Verify Unlock Status
After automatic factory reset:
adb reboot bootloader
fastboot getvar unlocked
# Should return: yesOr check on device boot:
- "The bootloader is unlocked" warning (normal)
Root Installation
Determine Correct Image
The target is not determined by OnePlus generation, the running Android version, the presence of an init_boot.img file or Magisk's Ramdisk field alone. Depending on the exact model and firmware, Magisk may patch boot, init_boot, vendor_boot or recovery. See Magisk's image-selection guidance and verify the model-specific partition and slot before proceeding.
Keep Magisk's AVB/verity and encryption defaults unless a reliable exact-device procedure explains a change and its risks. Do not disable vbmeta verification as a generic rooting or recovery step.
Method 1: Boot Image Patching (Recommended)
Step 1: Obtain stock firmware
Download firmware for the exact device, region and installed build. Oxygen Updater is a third-party source of update packages; check that its available package matches, rather than assuming an offered update is the current firmware. If the required build is unavailable, stop and seek a trusted model-specific source.
Step 2: Extract and verify the image
Some full update packages contain payload.bin. The payload-dumper-go utility can extract supported payloads:
payload-dumper-go -o extracted payload.binIncremental OTAs may require the exact base images and the extractor's -old option. Verify which extracted image contains the target ramdisk for the exact build, and keep the original firmware and stock image for recovery.
Step 3: Patch on the device
Transfer the verified image to the phone, install the official Magisk APK, and select Install > Patch firmware / image > Select from storage. Patch on the same device that will use the result; do not use a shared pre-patched image.
Step 4: Flash the patched image
Replace the example filename with the actual Magisk output. On A/B devices, check the current slot and follow the exact model's instructions for the intended slot. Do not flash both slots or switch slots blindly.
adb pull /sdcard/Download/magisk_patched-EXAMPLE.img .
adb reboot bootloader
fastboot devicesOn standard A/B devices, unsuffixed fastboot flash commands for a slotted partition target the current active slot by default (AOSP); fastboot getvar current-slot reports the slot selected for the next boot. Use these examples only if that is the intended slot and the image matches its firmware. For a different slot, follow the exact-device procedure instead.
Run only one command matching the verified original image and target partition:
If you patched the verified boot.img:
fastboot flash boot magisk_patched-EXAMPLE.imgIf you patched the verified init_boot.img:
fastboot flash init_boot magisk_patched-EXAMPLE.imgFor vendor_boot or recovery, follow the Magisk guide and the exact-device instructions instead. A recovery-based installation requires its recovery boot sequence to enable Magisk. For the boot or init_boot examples above, reboot with fastboot reboot and complete any Magisk setup prompt.
Step 5: Verify root
Confirm the Magisk card reports an installed version. Grant a trusted app access in Superuser before testing; for adb shell su -c id, first grant ADB shell and revoke that grant afterward if not needed.
Method 2: TWRP Recovery (Older Devices)
Magisk's custom-recovery installation is deprecated and requires a boot ramdisk. It cannot install or upgrade Magisk when Magisk itself must be installed in recovery. Confirm that the TWRP build and its installation method support the exact model and firmware; a recovery may not decrypt /data.
For a supported legacy device, upstream describes renaming the official Magisk APK to .zip, installing it in recovery and completing the app's direct reinstallation. Do not assume fastboot boot twrp.img or a separate recovery partition works across OnePlus models.
Post-Root Setup
Configure Magisk
Grant only trusted apps access in the Superuser tab. Enable Zygisk only when a trusted module needs it. DenyList can revert Magisk modifications in selected processes but does not guarantee app compatibility; the old Hide the Magisk app rename option is no longer available in current Magisk releases. See the Magisk guide and Play Integrity guidance.
OxygenOS/ColorOS Optimization
Battery Optimization:
- Settings > Battery > Battery optimization
- Find Magisk and root apps
- Set to "Don't optimize"
Autostart Permission:
- Settings > Apps > Manage apps
- Magisk and root apps
- Enable "Autostart"
Background Restrictions:
- Settings > Apps > Manage apps
- Magisk and root apps
- Disable "Restrict background activity"
OTA Handling
For supported A/B devices
Magisk's A/B OTA instructions were tested on Pixel; OnePlus procedures vary. Use the following only when the exact device and update method support it:
- If stock images are required, choose Uninstall > Restore Images in Magisk before applying the OTA. Do not reboot. If the necessary backup is unavailable, stop and use a verified exact-device update or recovery method.
- Apply the OTA and wait for installation to finish. Do not restart yet. Modified read-only partitions may cause verification to fail.
- In Magisk choose Install > Install to Inactive Slot (After OTA) and wait for completion.
- Return to the system update screen and select Restart now. Verify root after boot.
If the option is unavailable or the update fails, follow the device-specific stock update instructions, then patch an image from the new build if desired. Root preservation is not guaranteed.
Troubleshooting
Click to expand troubleshooting tips
Bootloader Issues
"OEM Unlocking" Greyed Out
Check the exact model and carrier eligibility. Some carrier variants require a token or other authorization. A factory reset or waiting period is not a guaranteed fix; contact OnePlus or the carrier if eligibility is unclear.
Fastboot Not Detecting
Solutions:
- Update Platform Tools
- Try USB 2.0 port
- Different USB cable
- Reinstall drivers (Windows)
- Try different computer
Installation Issues
Magisk Shows "N/A"
Verify the exact firmware, selected image, partition and slot against the device-specific instructions. If Magisk was installed in recovery, use its required boot sequence. Do not choose a different image solely from Android version or reflash blindly.
Device Bootloop
If only the Magisk image was changed, restore the matching stock image to every affected partition and slot using the exact-device recovery procedure. Restoring boot alone does not fix a mistaken write to init_boot or another partition. For wider changes or uncertain slot contents, use a verified full-firmware recovery method or contact OnePlus Support. It may wipe data. Do not change slots or downgrade blindly.
Root Access Issues
Apps Not Getting Root
Check that Magisk reports installed, then explicitly grant the trusted app in Superuser before it requests su. If testing with ADB, grant ADB shell first. Revoke access when it is no longer needed. Check the install log and exact-device instructions before reinstalling.
Play Integrity Fails
Follow the module stack and configuration order in Play Integrity and Banking Apps.
Unroot and Restore
Remove Root Only
If Android boots and the necessary stock backups exist, use Uninstall > Complete Uninstall in Magisk. Restore Images is an OTA preparation step, not a complete uninstall. Other modifications or affected slots may still need stock recovery; the bootloader remains unlocked.
Flash Stock Firmware
Use OnePlus Support or a trusted guide for the exact model, region and firmware to obtain a compatible complete recovery package and procedure. Back up first; a full restore may wipe data. Do not assume a generic flash-all script or MSM/EDL tool exists, works without authorization, or is safe for every OnePlus model. If the supported recovery method is unclear, contact OnePlus instead of guessing.
Relock Bootloader (Optional)
RELOCK WARNING
Relocking a modified or incompatible device can make it unbootable and may erase data. Only consider it after restoring compatible stock firmware and verified-boot state for all required partitions and slots, successfully booting, and confirming a manufacturer or exact-model procedure. There is no safe universal OnePlus lock command.
Best Practices
Security
- Grant root only to trusted apps
- Use DenyList where appropriate, without assuming it bypasses app checks
- Only install trusted modules
- Keep Magisk updated
- Back up stock images
- Use strong device security (PIN, password, biometrics)
Community Resources
Official OnePlus:
- OnePlus Forums - Official community
- OnePlus Support - Official support
Firmware Downloads:
- Oxygen Updater - Third-party firmware update downloader
- Oxygen Updater GitHub - Alternative download
Developer Community:
- XDA OnePlus Forums - Device discussions
- Reddit r/OnePlus - Community help
Getting Help
When asking for help, provide:
- Exact OnePlus model
- OxygenOS/ColorOS version
- Android version
- Which image patched
- Exact error messages
- Steps attempted
Next Steps
- Root setup: Post-root configuration
- Tools: Apps and modules
- Common tasks: Debloating · Ad blocking
- Optional extensions: LSPosed · Custom ROM installation