In this article, we are going to root OnePlus 9 and 9 Pro via Magisk but without using the TWRP (aka TeamWin Recovery Project). The steps are a bit tricky but that is for the first time, from next time, it will be a piece of cake.
What is Rooting?
While it might sound scary, rooting simply refers to the act of obtaining access to commands, system files, and folder locations that are usually locked off for the user. Rooting Android can be thought of as promoting yourself from a system user to an administrator; with the additional freedom and risks that come from more control over the deeper workings of your device. With great power come great responsibility and all that! More specifically, adding root to Android means becoming a superuser, which is a Linux function that you may be familiar with. In many ways then, you could view this more as restoring a function that should have been there, to begin with! Rooting is no longer always essential for flashing a custom ROM, however, it is advisable to root Android in some cases to make use of the most interesting features.
How Rooting Actually Works?
Usually, rooting is a three-step affair: Unlock the bootloader, flash a new recovery, then use the new recovery to flash a ZIP file that will give you root access. The first thing you need is an unlocked bootloader. For most popular devices, there’s some kind of workaround to unlock the bootloader. Before going forward, check if your device’s bootloader can be unlocked via a quick Google search. Once the bootloader is unlocked, the next thing is to switch from the system recovery to custom recovery. A third-party recovery like TWRP lets you do things like flash zips, install tweaks, make backups, and execute commands. We’ll use our new recovery to flash a.ZIP that will give us root access.
Steps to Root OnePlus 9 and 9 Pro
Step1: Setup Fastboot and ADB
What is ADB
ADB stands for Android Debug Bridge, it is a command-line tool, and by using ADB you can access each part of your Android through the command line. It is a tool used to flash TWRP recovery and also to unlock Bootloaders.
What is Fastboot
Fastboot is a protocol that is used to re-flash the system partition on your Android device. It is a small yet powerful tool that comes up with the Android SDK (Software Developer Kit) which is an alternative to all the recovery mode installations and updates. While re-flashing the system partition Fastboot requires a device with an unlocked bootloader. According to Android Central, Fastboot is three different things within the same name, it is
A protocol for communication between your phone hardware and a computer.Software that runs on the phone when in Fastboot/bootloader mode.The executable file on the computer you use to make them talk to each other.
All Android devices don’t have a user-accessible Fastboot mode, it is possible just after Nexus devices have enabled the fastboot mode by default. Some independent Android developers and tech enthusiasts make the Fastboot mode possible on some different phones. We have written a comprehensive guide to setup fastboot and ADB in any operating system like Windows, Linux, and macOS, check that out to set it up properly, How to Install ADB and Fastboot?
Step 2: Unlock Bootloader
The bootloader is the piece of software on your phone that boots up the system recovery and the operating system. When you boot up the phone, this is the first piece of software that runs. Or simply bootloader is Lowest level software on your phone that starts up recoveries and then the main operating system. And unlocking bootloader means you are opening the only way to temper the core operating system, the functions varies from rooting the system and providing the main system access and replacing the default operating system with any other stock Android OS or any other custom UI based on Android. We have written a comprehensive guide to unlock bootloader on OnePlus 9 and 9 Pro, have a look at that to learn how to unlock it, How to Unlock Bootloader on OnePlus 9 and 9 Pro
Step 3: Download Stock Firmware
As the devices are new, so OnePlus is yet to list the firmware to their official website, but thanks to the folks at XDA-Developers, we already have the download links of these firmware.
Step 4: Extract boot.img File from Firmware
This can be a tricky step, as you will have to install Python and do a few more things to extract the boot.img file from the downloaded firmware. We are not going to discuss every step in this article. But for your convenience, we are linking a great guide written by Sadique Hassan (from DroidWin), read that article and you will be good to go. But if you want the fully extracted boot.img files then use these below links to download the latest boot.img files, we always recommend you extract the files by yourself.
Step 5: Patch boot.img File via Magisk
Now, we are going to patch the boot.img file via magisk so that it can be used to root the device.
First, go to this Github repo and install the latest Magisk Manager available. The latest release will be there under the asset section.Install the apk file and then open the Magisk Manager from the app drawer.On opening the Magisk Manager, you will notice a button named ‘Install’ in front of the Magisk section.Click on that button and then select the ‘Select and Patch a file’ radio button. This will open the file explorer, from there navigate to the previously extracted boot.img file.Select the boot.img file, and then let Magisk Manager patch the file.
On successful completion, the Magisk Manager will automatically download the patch file. Save it in a safe place (the ADB directory on your PC will a perfect place).
In case you don’t want to all these hazel then use the below-patched boot.img files, we always recommend you patch the files by yourself.
Step 6: Boot into Fastboot Mode
Now, connect your device to the PC where you setup the fastboot and ADB.Then, open the terminal. make sure that your Terminal is in the exact same folder your ADB tools are in, and then you can run the following command to launch the ADB daemon,
After executing the above command, the device (serial number) will be listed in the terminal window.Now, type and execute the following command to open the bootloader (fastboot mode).
Now, execute the following command to verify the fastboot mode.
If you get the same serial number followed by the fastboot keyword that we got in the ABD mode, then the connection stands successful. [Don’t close the terminal window, we will be using the same terminal in the next step.]
Step 7: Root OnePlus 9 and 9 Pro by Flashing the Patched File
Now, that we have copied the previously patched boot.img file (Step 5) in the ADB directory on our PC and the terminal (Step 6) is already opened, we will continue using the terminal for rooting the device.
Type the following command in the terminal window and hit enter to execute it,
After completion, use the following command to reboot the device to system,
Final Verdict
That was it, we have successfully learned all the necessary steps required to root OnePlus 9 and 9 Pro. I know, these steps were a bit tricky but that is for the first time, from next time, it will be a piece of cake. In case you didn’t understand any step, or you can any other query regarding this article, then feel free to comment down below, we will be more than happy to assist you. Peace ????