In this guide, we will show you how to install TWRP Recovery on the OnePlus 7 and OnePlus 7 Pro (5G), and then how to use it to root your phone using Magisk.
When we talk about Android custom development and software modding, OnePlus devices are always among the front-runners. This notion is further made stronger by the fact that the bootloader on these devices is pretty easily unlockable. And the OnePlus 7 and OnePlus 7 Pro are no different.
If you’re into software modding, TWRP is a tool you should be familiar with. It is a custom recovery that will allow you to flash custom ROMs, kernels, mods like ViPER4Android and Xposed Framework, and even take NANDroid backups of the complete Android OS. If you’re after rooting, you can also use TWRP to flash Magisk and root your phone in a matter of minutes, something we’ll be demonstrating in this tutorial as well.
TWRP for the OnePlus 7 and OnePlus 7 Pro is brought to the community by XDA Recognized Developer mauronofrio. He is also the one who is officially maintaining the official builds being posted on the TWRP website.
According to the developer, the recovery is completely usable and supports Android 11, Android 10, as well as Android 9 Pie. It can also decrypt the /data
partition on the latest version of Android. The only existing issue with the recovery is that the vibration does not work while in recovery mode, which doesn’t affect the recovery’s functionality at all.
With that aside, let us show you how to install TWRP recovery on the OnePlus 7/OnePlus 7 Pro and subsequently root the phone using TWRP and Magisk. The instructions in this tutorial will take you through the complete process in a comprehensive manner.
If you do not plan on using TWRP for flashing ROMs, taking NANDroid backups, etc, then you can also root the OnePlus 7/7 Pro without TWRP Recovery.
Table of Contents
Before You Begin
Before you start, there are a few things you should do.
1. Take a Complete Backup
Installing TWRP or rooting your OnePlus 7/Pro using the instructions here will not erase any data. However, it’s generally a good practice to take a complete backup of all your important data beforehand. This will create a failsafe in case the data is lost due to corruption or a bad flash.
If you need guidance in the matter, you could refer to our tutorial on backing up Android devices.
2. Install OnePlus USB Drivers
If you’re operating on a Windows computer, it will generally install the required USB drivers for your phone automatically. But that’s not always the case, and especially when working with ADB and Fastboot. So, it’s best that you install the latest version of the OnePlus USB drivers on your computer.
Users operating on macOS or Linux computers will not need any drivers at all.
3. Charge your Phone
Make sure that your OnePlus 7 device has a sufficient battery charge so that it doesn’t turn off accidentally while performing the instructions. We suggest having at least 40% battery charge before you begin.
4. Unlock the Bootloader
In order to install TWRP, root, or flash the device partitions, you must first unlock the bootloader of your OnePlus 7. Like we said earlier, this is extremely simple and could be done by issuing a fastboot command from your computer.
- More info: How to Unlock OnePlus 7 (Pro) Bootloader
Instructions
In order to make it easier for you to understand, we have split the whole process into 7 steps. So, follow the steps below to install TWRP recovery on your OnePlus 7 (Pro) and then root it using Magisk.
Step 1: Install Android SDK Platform-tools on Computer
You will be flashing TWRP using a fastboot command. So, the first step is to install the Android SDK platform-tools on your computer. Begin by downloading the latest platform-tools for your computer using the links below.
Once you have downloaded the tools, extract the ZIP package to get the “platform-tools” folder. This folder should contain the binary files of the required tools, such as ADB and Fastboot.
For easier access, we suggest you move the “platform-tools” folder to the root of the C:\ drive if you’re using a Windows computer, or inside the “Documents” directory if you’re using a macOS/Linux PC.
While you could use one-click ADB/Fastboot installers like Minimal ADB and Fastboot, we recommended doing it the manual way as shown above. This is because one-click installers often include outdated platform-tools binaries, which may cause unusual errors during usage.
Step 2: Download TWRP and Magisk Files
The second step is to download the files you’ll need further down this guide. These include the TWRP recovery for the OnePlus 7/7 Pro and the Magisk flashable installer ZIP file.
- TWRP Recovery Image: twrp-3.5.0_9-0-guacamole.img
- TWRP Installer ZIP: twrp-installer-3.5.0_9-0-guacamole.zip
- Magisk Installer ZIP: Magisk-v21.2.zip
At the time of updating this guide, TWRP 3.5.0 and Magisk 21.2 are the latest versions of the respective tools. Make sure that you check and verify the latest version of TWRP here and Magisk over at Github.
Once the files have been downloaded, move the TWRP recovery image (e.g. twrp-3.5.0_9-0-guacamole.img) inside the ‘platform-tools’ folder you extracted during the previous step.
Next, connect your OnePlus 7 to the computer via USB and transfer the TWRP Installer (e.g. twrp-installer-3.5.0_9-0-guacamole.zip) and Magisk ZIP (e.g. Magisk-v21.2.zip) files to internal storage.
Step 3: Launch Command-line Inside ‘platform-tools’ Folder
Now that you have the required tools installed and the TWRP recovery image in the correction location, the third step is to launch the command-line inside the working directory (i.e. ‘platform-tools’ folder). If you’re experienced with using the command-line, you could alternatively add the platform-tools to your computer’s PATH.
- Launch PowerShell in Windows: Go to C:\platform-tools. Hold the SHIFT key on the keyboard and right-click on any empty space inside the folder. Then select the “Open PowerShell window here” option.
- Launch Terminal in Linux/Mac: Launch the Terminal and use the cd command to change its directory to the “platform-tools” folder. For example: If you moved the folder inside the “Documents” directory, then the command should be:
cd Document/platform-tools
Command-line Usage:
When entering the commands, make sure to prepend them with a dot and backslash [.\] in Windows PowerShell, and a dot and forward slash [./] in Mac/Linux Terminal.
Step 4: Enter Fastboot Mode on your phone
Your phone can only accept fastboot commands while it’s in a dedicated boot mode known as ‘Fastboot Mode’. So, you have to boot your OnePlus 7/7 Pro into Fastboot Mode.
To do this, first power off your phone and wait for a few seconds to ensure that it’s completely off. Then hold the Volume Up, Volume Down, and Power keys together until you see the fastboot mode screen. With your phone in Fastboot Mode, connect it to your computer using the USB cable.
Here’s what the Fastboot Mode on OnePlus looks like:
Step 5: Install TWRP Recovery on OnePlus 7/7 Pro
The OnePlus 7 and OnePlus 7 Pro support the A/B partition scheme, without a dedicated recovery partition. In which case, TWRP recovery must be installed to the /boot
partition itself. This is done by booting the recovery image using fastboot to enter TWRP and then flashing the installer script.
So, how do you do it? It’s quite easy. First, temporarily boot TWRP on your phone by using the following command:
fastboot boot twrp.img
“twrp.img
” in the above command should be replaced with the full filename of the recovery image you’ve downloaded. For example, if you have downloaded the latest TWRP 3.5.0-9 recovery image, then the command should be:
fastboot boot twrp-3.5.0_9-0-guacamole.img
As soon as the command is entered, your phone will instantly reboot and enter the TWRP recovery mode.
If you have lock screen security set up on your phone, then TWRP will prompt you to enter the PIN/Password. This is required so that TWRP can properly decrypt the /data
partition (internal storage). So, make sure that you input the PIN/password when prompted.
Now, go to the ‘Install’ menu in TWRP. Navigate the internal storage and select the TWRP installer ZIP file (e.g. twrp-installer-3.5.0_9-0-guacamole.zip) to add it to the flashing queue. Once the file is selected, swipe the button on the bottom to flash it. The script will patch both the boot_a
and boot_b
partitions and permanently install TWRP on your OnePlus 7/7 Pro.
Once the installation finishes, go back to the recovery’s main screen. Why? If you attempt to boot your phone into the OS right away, it will end up in a bootloop. That’s because DM-Verity will be triggered and will prevent the phone from booting if any partitions have been modified. In the next step, you will flash Magisk which will not only root the phone but will also disable DM-Verity simultaneously.
Step 6: Root OnePlus 7/7 Pro by Flashing Magisk ZIP
The seventh and last step of this tutorial is to flash the Magisk ZIP file using TWRP and root your OnePlus OnePlus 7/7 Pro.
To do this, press the ‘Install’ button on the TWRP main screen. Then navigate to the internal storage of your phone and select the Magisk ZIP file (e.g. Magisk-v21.2.zip) to add it to TWRP’s flashing queue.
Finally, swipe the button on the bottom of the screen to install Magisk and finally root your phone. The flashing process will take a few seconds to finish. Once it is complete, you can press the ‘Reboot System’ button to reboot your OnePlus 7/7 Pro into the system (OS).
Wrapping Up
Once your phone boots, you should see the Magisk Manager application among other apps in the app drawer. You can launch the app and verify Magisk’s installation status and version. You can further check if your rooted phone passes SafetyNet by pressing the ‘Check SafetyNet’ button in Magisk Manager.
SafetyNet fails and shows ‘Hardware’ evalType? It means that Google’s new hardware-backed attestation is now in effect on your phone.
You could try using the MagiskHide Props Config module and try spoofing your OnePlus 7 as another device to pass SafetyNet temporarily.
Now go ahead and start using root applications such as Titanium Backup. Root permissions for these apps can easily be managed from within Magisk Manager. You can also install mods like Xposed Framework, and ViPER4Android to tune up your phone’s audio. With TWRP, you can also flash a variety of different custom ROMs, kernels, and mods available for your OnePlus 7 and OnePlus 7 Pro at XDA.
So by now, you have learned how to install TWRP recovery on the OnePlus 7 and OnePlus 7 Pro (5G) and root it with Magisk. If you have any questions in regards to the instructions or find yourself stuck anywhere, let us know.
TWRP source: XDA