How to Root Android 11 using Magisk – The Complete Guide

How to Root Android 11 using Magisk - The Complete Step-by-Step Guide

It’s been more than a month since Google released the Android 10 update. If you have updated your phone and further wish to root it, then you’d be glad to know that Magisk v21.0 has been released with full Android 11 support. In this guide, we will show you how to root your device running Android 11 using Magisk. This could be easily done by patching the boot image and then flashing the patched boot image using Fastboot.

Before we get to the instructions, we would like to talk a bit about the core changes in Android 11 and how they affected Magisk/root development. If you’re not into the technical details, you could head over to the instructions directly.

Table of Contents

Android 11 & Magisk Root Development: Recap

Every major Android release tends to bring some new challenges for the custom development community, especially the rooting part. And Android 11 wasn’t any different. Back when Google released the Android 11 developer preview, Magisk’s creator John Wu (@topjohnwu) was quick enough to hop onto the development with his new Pixel 4 XL running Android 11.

topjohnwu on inital Android 11 root development

  • The first thing pointed out by the developer was the removal of the /sbin folder from the root directory in Android 11. This folder (up until Android 10) was used to load all Magisk binaries such as magiskinit etc. With the unavailability of the /sbin folder, the developer had to work out an alternative way to add Magisk binaries to the PATH. With the latest v21.0 on Android 11, Magisk now randomly creates a folder under /dev and uses it as a base folder.
  • John also added that Google removed init.rc from the root directory and moved it to /system/etc/init/hw/init.rc. For those who do not know, init.rc is a key component of Android that initializes the Android boot sequence (Read more about it here or follow the official documentation).

While not much, these two changes themselves are quite major and change how Android behaves at the early boot. It took a lot of time and effort from John to get around these new challenges and he finally merged the required fixes for Android 11 support to the Magisk Canary channel.

topjohnwu merged Android 11 support into Magisk Canary channel

The developer has released Magisk 21.x that adds full support for Android 11 to the stable channel as well. Users who already have Magisk v21 installed can easily upgrade to the stable Android 11 update without losing root.

How to Root Android 11 using Magisk

Installing Magisk and rooting your device running Android 11 is quite easy. In brief, you first have to get a copy of the stock boot image for your phone. Then you have to patch that boot image on-device using the Magisk Manager application. And finally, you have to flash the resultant patched boot image to your phone using Fastboot commands. The steps below will take you through the process in detail.

Before you begin, make sure that you take a backup of all your important data. Although nothing shall be wiped off your phone while rooting using this method, it is good to safeguard the data anyways.

Requirements

  • Your Android 11 device
  • A Windows, macOS, or Linux computer
  • A compatible USB cable

Step 1: Unlock the Bootloader

To root Android 11, unlock your phone's bootloader first

While installing Magisk and rooting your phone, you’d need to flash the patched boot image to your phone. To do this, you’d first need to unlock the bootloader of your phone. If your phone’s bootloader is already unlocked, you do not need to do it again.

Note that unlocking the bootloader will erase all the data on your phone, including that on the internal storage.

On most stock Android devices such as the Google Pixel series, or OnePlus phones, the bootloader could easily be unlocked using a couple of Fastboot commands. The tutorial linked below will take you through the process in detail.

Some manufacturers like Asus, Realme, Xiaomi, etc would require you to use special tools for bootloader unlocking. Xiaomi/Redmi/Poco phone users could simply use the official Xiaomi Unlock Tool. Realme users could refer to the official tool collection here. Alternatively, you could also search our website to find your device-specific tutorial.

Step 2: Get the Boot Image for your Phone

The second step is to get the stock boot image for the Android 11 software version currently installed on your phone.

If your phone’s manufacturer allows bootloader unlocking, chances are that they also provide download links for the factory images. These factory images (also sometimes referred to as “fastboot images”) are in form of .zip archives and contain .img files of individual device partitions. For the rooting process, you’d need the boot image file that’s generally named as boot.img.

Get the boot image for your phone

Google Pixel owners can get the Android 11 factory image for their phones from the official repository.

Some manufacturers like OnePlus, Asus, etc, only provide OTA update packages (instead of factory images) for their phones. Users with devices from such manufacturers would need to go an extra step to extract the OTA payload.bin to get the boot image file. An alternative (and easier) way to get the boot image is to look up for your device-specific section at XDA-Developers or check out firmware.mobi.

Once you have the boot image, transfer it inside the “Download” folder of your phone’s internal storage. You can copy it anywhere actually, but we chose the ‘Download’ folder for convenience.

Note: It is very important that the boot image you use matches the software version/build number that’s currently installed on your phone. Using a boot image from a different software version could result in a boot loop or cause unexpected behavior of WiFi, mobile data, etc.

Step 3: Install Magisk Manager v8.0.2+ on your Phone

First, download the APK file of Magisk Manager v8.0.2 (or above) from the official Github release page directly to your phone. Then, launch a file manager application of your choice and navigate to the folder where the file was downloaded (generally ‘Download’ folder in internal storage). Locate the downloaded file (e.g. MagiskManager-v8.0.2.apk) and tap on it to launch Android’s in-built package installer. Press “Install” and wait for the installation to finish. Once it is, press “Ok” or “Done”.

Install Magisk Manager v8.0 on your phone

You might be prompted to allow access for the installation of unknown apps. If you do not know how to do it, then follow the link below.

Step 4: Patch the Boot Image with Magisk Manager

Now that you have both, the boot image and Magisk Manager installed, it’s time to patch it. To do this, launch the Magisk Manager app and press the cogwheel icon on the top-right to access the “Settings”. Tap on “Update Channel” and set it to “Beta”. This is because Magisk v21.0 is currently not available on the Stable channel, but only on the Public Beta channel (not for long though).

Change Magisk Manager's Update Channel

Next, go back to the main screen, press “Install” and choose “Select and Patch a File” from the list of available methods. The file selector will open, so navigate to the “Download” folder of your phone’s internal storage and select the boot image file (boot.img).

Patch the Boot Image with Magisk Manager

Once the boot image is selected, press “Let’s Go”. Magisk Manager will start downloading the latest version of Magisk i.e. v21 and patch the boot image with it. Once done, the resultant patched boot image will be stored inside the “Download” folder.

Boot Image Patching Complete

Step 5: Set up Android platform-tools on your Computer

You have the boot image patched with Magisk and ready to be flashed to your phone. To carry out the flashing process, you will need to set up the Android platform-tools on your computer. So start by downloading the latest platform-tools package according to your PC’s operating system from the links below.

Once downloaded, extract the contents of the zip archive to get the ‘platform-tools’ folder. Next, move this folder to an easily accessible location on your PC for installation. For example, move it to the C:\ drive if you’re using a Windows PC or inside the ‘Documents’ directory on a Linux/Mac machine.

If you need detailed instructions for installing these tools, refer to the tutorial linked below.

Step 6: Launch Command-line Window Inside ‘platform-tools’ Folder

With the tools installed, it is important to launch the command-line window inside the ‘platform-tools’ folder. This is because the command-line can only recognize files that are added to the PATH and/or are inside the folder where it’s open. To do this:

  • On 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.
    Step 6: Open PowerShell inside the 'platform-tools' folder
  • On 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

At this point, everything on your computer is now set up to carry out the flashing process.

When entering the mentioned commands, make sure to prepend them with a dot and backslash [.\] in Windows PowerShell or a dot and forward slash [./] on Mac/Linux Terminal. For reference, take a look at the figures below.

Step 7: Transfer the Patched Boot Image to your Computer

As mentioned earlier, the boot image is stored inside <internal storage>/Download after patching. It is named magisk_patched.img so that it’s easier for the users to identify.

So, connect your Android 11 device to the computer via the USB cable and turn on the “File Transfer” (MTP) mode on it. Then copy the Magisk patched boot image from inside the “Download” folder to the “platform-tools” folder on your PC. Disconnect the phone after the transfer is complete.

Step 7: Copy Magisk Patched Boot Image inside 'platform-tools' folder

Step 8: Boot your Phone into Fastboot Mode

Step8: Boot your phone into Fastboot Mode

The Fastboot tool can only recognize and flash files to your phone over the bootloader interface, which is more commonly known as “Fastboot Mode” or “Bootloader Mode”.

To enter Fastboot Mode, enable USB debugging on your phone, connect it to the computer, and execute the adb reboot bootloader command from your computer.

Another easier way to get into Fastboot Mode is by using the buttons combination while the phone is powered off. On a lot of Android devices (especially Google Pixel and stock Android devices), it could be done by holding the Volume Down and Power keys together.

Step 9: Flash the Patched Boot Image to Root your Android 11 Device

Finally, it’s time to flash the patched boot image to install Magisk and root your Android 11 device. To do this, connect your phone to the computer over USB while it is in Fastboot Mode.

Then verify that your PC can recognize your phone over the bootloader interface using:

fastboot devices

The command should return your device’s unique ID, as shown in the figure below. If you’re operating on a Windows computer, you might see an empty output, which indicates that there is a driver issue. You could fix this by downloading and installing the latest Google USB drivers on your PC.

Step 9: Verify Device-PC connection over bootloader interface

Now enter the following command on your computer to flash the patched boot image to your phone:

fastboot flash boot magisk_patched.img

Step 9: Flash Patched Boot Image to Install Magisk and Root Android 11

It’s worth noting that the boot image will only be flashed to the currently active slot on devices that support the A/B partition system. This is extremely useful for installing OTA updates on rooted phones.

After the flashing is complete, reboot your phone into the OS using:

fastboot reboot

You can disconnect the phone now and wait for it to finish the boot.

Wrapping Up

That’s it! Your Android 11 Device is now rooted. To verify this, launch the Magisk Manager application on your phone and check the info corresponding to the “Installed” label. It should show the latest Magisk version. You can further check the SafetyNet status by pressing “Check SafetyNet”.

Magisk not passing SafetyNet on Android 11? – Read about SafetyNet’s hardware-backed attestation

Android 11 successfully rooted with Magisk and passes SafetyNet tests

Now that you have root access, you could install and use some of the most popular root applications such as Titanium Backup. You could also use Magisk Manager to install modules for adding new features to the software.

Furthermore, if certain apps like banking and security apps stop working, simply go to ‘Magisk Manager’ > ‘Settings’ and enable Magisk Hide. Since Magisk v20.4, this feature is disabled by default on new installations in light of the new SafetyNet attestation method.

If you have any questions regarding the rooting process and need help, comment below.

Comments

  1. Hello,

    Thank you so much. It worked for me. OnePlus 7 Pro.
    I’m running now Oxygen OS 11.0.0.2 with Magisk. 🙏👍

    Easy and simple process.

  2. Which version good for rooting Android 10? I tried both stable and canary but both of them destroyed the recovery image. Could you give some advice how to do it

    1. Which device is it, Chmomin?

      The latest version of Magisk (v22) on both the Stable and Canary channel supports Android 11.

    1. Make sure that you use the OnePlus 7T A11 Beta 4 boot image. To recover your device, simply flash the stock boot image of Beta 4 through fastboot and it should be fixed.

      Next, patch the Beta 4 boot image with Magisk v22 (only Magisk v21+ supports Android 11).

      One more thing, this tutorial was written back when the stable Magisk release wasn’t updated to support Android 11. Since it’s available now, there’s no need to change Magisk’s update channel under step #4. The rest of the process stays the same.

  3. Good evening
    I just managed to “root” on my device.
    My error was as follows: I had not placed the modified file “magisk_patched.img” in the correct directory which must be “platform-tools”.
    So I finally got to root the 1+ 8P ….
    Now I just have to recover my application data saved on the Samsung S7 with Titanium which I can now use …
    Everything is OK
    Thank you very much for all your help …

    1. I am glad it all played out well at last. Good luck with your rooted OnePlus 8 Pro, Jean. And you’re welcome!

  4. I add that the installed version of Magisk is 20.4 (20400).
    It is therefore not version 21 as you announced in a previous exchange this morning.
    Perhaps this is where the error in building the image modified by Magisk comes from.
    On your screenshots the version of Magisk is the 21 and for me too after changing the channel to Beta …
    I will try to redo an edited image and resume the process ….

    1. Sure, Jean. As I said, Magisk v21 is what you should be using when running Android 11. Let me know how that goes.

  5. Hello….
    I failed to root my 1+ 8P ….
    I watched your entire tutorial after unlocking the bootloader.
    I have flashed the file modified by Magisk before all the procedures: magisk_patched.img
    This file is exactly the same size and has the same date and time as the “boot.img” file. Is it normal ?
    The “fastboot flash boot magisk_patched.img” command was performed normally and I was able to restart the device without any problem.
    But there is no Magisk app installed and Titanium and Root Checker confirm to me that the device is not rooted …
    An idea ? Did I miss something?
    Thank you for your advice

  6. @Dhananjay Bhardwaj
    Thank you for your quick feedback
    I sent you in private messaging two screenshots for the current version on my device, namely 11.0.1.1. (I should have specified this) and the name of the zip file downloaded with Oxygen Updater yesterday …

    1. Jean, if you have extracted the boot image from the ROM package downloaded through Oxygen Updater, then it should be the right one.

  7. good morning
    in step 4 of your tutorial, you indicate:
    “access the“ Settings ”. Tap on“ Update Channel ”and set it to“ Beta ”. This is because Magisk v21.0 is currently not available on the Stable channel, but only on the Public Beta channel (not for long though) . ”
    I just installed the “stable” version of OxygenOS11 after reverting to version 10.
    So I have a “boot” image of a stable version 11.
    My question: do I have to keep the “Beta” string and not the “Stable” string to get the new file?
    Thank you for your help and your advice.

    1. Jean, are you certain that you have boot image for the installed OxygenOS version? OxygenOS 11.0.0 boot image will not work on OxygenOS 11.0.1.1.

      And yes, selecting Beta as Magisk’s update channel is mandatory for rooting Android 11. The stable channel currently includes Magisk v20.4, which does not support Android 11. That’s why you need to select the Beta channel, that includes Magisk v21.0.

  8. Awesome article. Thanks.

    Unfortunately I’m looking for some additional info that is rather hard to find, because people have contradictory opinions/statements.
    I just got my Pixel 5 and rooting is easy with Pixel phones.
    However, I want to know, if the OTA updates will still work. (Some people say yes, others say the update might be downloaded, but fail during install.) Hmm, so that’s pretty useless, because I still don’t know anything.
    But maybe you have some answers.
    In case the OTA updates don’t work, would I have to go through the process you described every month? This seems rather tedious, especially if there’s a chance data is lost.
    I’d appreciate any info on that topic.

    1. Hello. First of all, thank you for the appreciation. Yes, it’s completely possible to take OTAs whilst rooted. I do all the time on my Pixel 3 XL, Pixel 2 XL, as well as on the OnePlus 8.

      I already have a tutorial on how to do it here. It not only includes the instructions, but also information on why OTA updates could not be installed straightaway when the phone is rooted, and also how Magisk can help you take OTA updates with root still persistent.

      The method in the tutorial I linked should work a 100%, except if you modify the /system partition directly. Like modifying the build.prop, etc. If there’s anything you would want to achieve with root, find how to do it via Magisk Module (If you can’t, let me know, I will try and look it up for you).

      Modifications applied via modules do everything systemless-ly, could be easily removed when not needed, and thus cannot cause the OTA method to break.

    2. Thanks for your reply. I wasn’t able to reply (there’s no button) to your comment thus I had to reply to myself.
      You don’t have to make this reply public.

      I also sent 2 emails, but don’t know, whether you got them or not

      The only thing that’s a bit puzzling is step 2 on the page
      https://www.thecustomdroid.com/install-ota-update-rooted-android-device-guide/

      If I have to upload (or keep the stock image on the phone in the Downloads
      dir) and revert to that image every month, it also seems rather tedious.

      Or is this step only making the phone believe there’s a stock image installed?

    3. I purposely made the comment nest only one-level deep so that they aren’t confusing if there are a lot of replies. You did the right thing replying to your own comment.

      Anyhow, let’s move on to your question. Step #2 in that tutorial doesn’t require you to keep a physical copy of the boot image. When you root your phone via the method above, Magisk will automatically backup your phone’s stock boot image and store it for the purpose of uninstalling and restoring (for taking OTA updates).

  9. Hello
    Question maybe off topic: can we install TWRP after routing the device (OnePlus 8 Pro)?
    Thank you to all of you.

    1. Jean, installing TWRP after rooting is rather redundant. If you wish to have TWRP with Magisk root, the basic logic is to install TWRP first and then use it to flash the Magisk ZIP file for root.

  10. This causes a bootloop in my Pixel 3 XL. Have to flash back the original boot.img to fix it.

    1. Kshitij, thanks for pointing that out. I have now added that users should download MM v8.0.2 (or above) for rooting devices on A11.

    1. You had OxygenOS 11 installed, am I right? Is it the Global, Europe, or Indian variant?

    2. Roberto, as pointed by another reader, it looks like using anything lower than Magisk v8.0.2 could cause a boot loop. Another common pitfall to avoid is by making sure that you change the “Update Channel” under Magisk Manager settings from “Stable” to “Beta”. Or else, the boot image will be patched with v20.4 doesn’t support Android 11. So that could turn out to be another cause of the boot loop.

      The first thing you should right now is to flash the stock boot image back to your phone. This shall allow your phone to enter the OS. We have maintained a repository for downloading stock boot images for the OnePlus 8 series.

    3. I have installed the global version on Android 11 . But now I only see in the phone the Bootloader and my computer does not recognize the phone .

      Can you send me a tutorial in order to recover the phone ?

      Many thanks

    4. I believe that caused the problem. Anyhow, I am currently in the middle of writing the unbricking guide, that could also allow you to recover.

      Since that would take some time, I suggest you visit this XDA thread for the same. If you face any problems or have any questions, feel free to let me know.

  11. Hi !! . I have followed all the instructions you have explained. Now my OnePlus8 does not start .
    What can I do, please ?

Leave a Reply

Your email address will not be published. Required fields are marked *