Home > ROMs > Custom ROMs

How to Root any Custom ROM via Magisk [Video]

In this guide, we will show you the steps to root any custom ROM using Magisk. While OEM nowadays packs in a plethora of features in their stock ecosystem, however, that might not be in sync with everyone’s requirements. On one hand, some OS skins end up giving up a bloated usage experience, whereas, on the other hand, the viral design and UI element of some OS might not be welcomed by all.

Apart from that, the OEM offers updates for a limited time frame, before the device reaches the EOL stage. Fortunately, there is a one-stop solution to all these issues- welcome abode a custom ROM onto your device! In this regard, there are a plentitude of AOSP-based ROMs that you could try out, with the likes of Lineage, Pixel Experience, and crDroid being just some of the noteworthy players in this domain.

And that’s just not it. You could even add tons of additional goodies by gaining administrative privileges by rooting your custom ROM via Magisk. And in this guide, we will show you how to do just that. Follow along.

Benefits and Risks of Rooting Custom ROM via Magisk

root custom rom magisk

Once you root your device, you will be in a position to flash a plethora of mods. These include the likes of Fox Magisk ModulesSubstratum ThemesXposed Framework via LSPosed, and Viper4Android among others. Along the same lines, you could also flash a custom kernel and implement your desired CPU profile. However, such tweaks do come with a few risks as well.

Pass SafetyNet crDroid

To begin with, rooting requires you to unlock the bootloader- which will wipe off all the data and could nullify the warranty as well. Likewise, SafetyNet will be triggered [FIXED] which will result in your inability to use banking apps [FIXED]. So if all that’s well and good, then let’s get started with the steps to root your custom ROM via Magisk.

How to Root any Custom ROM by Sideloading Magisk

The steps are applicable across most AOSP-based ROMs, including the likes of Lineage, Pixel Experience, crDroid, Xtended XT, Project Elixir, Nitrogen, and Evolution X [Exception: on my OnePlus 7T, rooting Derpfest ROM wasn’t possible via this first method and I had to use the second method given below to get the job done].

Moreover, while the process will not wipe off data, it is still recommended to be on the safer side and take a complete device backup beforehand. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.


NOTE: If your custom ROM supports rooting via the below method [Magisk Sideload], then you could also try out another method of rooting- by temporarily booting your device to TWRP and then flashing the Magisk APK! If you are interested in that method, then do check out our guide on How to Flash Magisk APK via TWRP Recovery [Video].


STEP 1: Install Android SDK

First and foremost, you will have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform tools folder, which will be used throughout this guide.

install adb platform tools windows

STEP 2: Enable USB Debugging

Next up, you will have to enable USB Debugging so as to make your device recognizable by the PC in ADB mode. So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging.

root custom rom

STEP 3: Download Magisk

  1. Download the latest Magisk APK and transfer it to your device as well as the platform-tools folder.
  2. Then rename the Magisk.apk inside the platform-tools folder to Magisk.zip.
  3. On the other hand, leave the Magisk in the APK format itself on your device. root custom rom

STEP 4: Boot to Recovery

  1. Connect your device to the PC via a USB cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
  3. After that, type in the following command in the CMD window to boot your device to Pixel Experience Recovery
    adb reboot recovery

    root custom rom

STEP 5: Sideload Magisk via Recovery

  1. From Recovery, go to Apply Update > Apply from ADB.
  2. Then type in the below command in the CMD window to sideload the Magisk ZIP
    adb sideload Magisk.zip

    root custom rom

  3. Wait for the process to complete. Once done, select Reboot System now.root custom rom

STEP 6: Install Magisk

  1. Even though you have flashed Magisk ZIP via sideload, it might still not be available in the app drawer.
  2. So go ahead and install the Magisk APK file that you have transferred in STEP 3. Once installed, launch it.root custom rom
  3. Magisk will now ask to complete additional setup, tap OK. Your device will now automatically reboot.
  4. Once it boots up, the Magisk will be successfully installed and your device stands rooted via Magisk.

That’s it. These were the steps to root the Custom ROM via Magisk. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

Root any Custom ROM via TWRP

Some AOSP Recoveries don’t give you the option to sideload unsigned ZIP files. You’ll get a Signature Verification Failed and that’s just about it. You wouldn’t be given any option to proceed ahead with the sideload. In such cases, you could either refer to the lengthier approach given in the next section or temporarily take the help of TWRP, which is what we will be doing now. Follow along.

  1. To begin with, download and extract Android SDK Platform Tools on your PC.
  2. Then download the latest Magisk APK and send it to your device.
  3. Now grab hold of the TWRP [only IMG file will do, no need for the ZIP] from its official site or XDA
  4. Then send it to the platform-tools folder. Likewise, rename it to twrp.img.
  5. Now enable USB Debugging on your device and connect it to your PC via a USB cable.Root Custom ROM via Magisk
  6. Then launch CMD inside the platform-tools folder and type in the below command to boot your device to Fastboot Mode:
    adb reboot bootloader
  7. Now type in the below command to temporarily boot your device to TWRP Recovery.
    fastboot boot twrp.imgroot custom rom
  8. From TWRP, go to Install > select Magisk.APK and flash it.root custom rom
  9. Once done, go to reboot and select System. Your device will now boot to the OS.root custom rom
  10. Now install the Magisk app as well. Once done, launch it.
  11. You will now get a prompt to complete additional setup, tap OK.root custom rom
  12. Then select Direct Install and tap on Let’s Go. Once done, tap Reboot. Your device will reboot to the rooted OS.

Root any Custom ROM via Magisk Patched Boot

This is the lengthier of the two approaches and should be tried out if the aforementioned method didn’t work out [For example, on my OnePlus 7T, rooting Derpfest ROM wasn’t possible via the first method and I had to use this second method to get the job done].

STEP 1: Install Android SDK

First and foremost, you will have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform tools folder, which will be used throughout this guide.

install adb platform tools windows

STEP 2: Enable USB Debugging

Next up, you will have to enable USB Debugging so as to make your device recognizable by the PC in ADB mode. So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging.

root custom rom

STEP 3: Extract Custom ROM Boot.img

First off, you will have to extract the custom ROM’s boot.img file. If the ROM is simply in a ZIP file, then the extraction could be done via WinZIP/WinRAR. On the other hand, if it is in a BIN format, then you will have to use the Fastboot Enhance Tool for extraction, as shown below:

  1. Download and extract Fastboot Enhance Tool on your PC.
  2. Then download and extract the custom ROM on your PC.
  3. Now launch Fastboot Enhance, go to Payload Dumper, and click Browse.root custom rom
  4. Select the extracted payload.bin file of the custom ROM and hit Open.
  5. Now go to the Partition tab, select boot.img, and click Extract Image.root custom rom
  6. Once done, transfer the boot.img file to the platform-tools folder.root custom rom

STEP 4: Patch Stock Boot.img via Magisk

  1. Download and install the Magisk App on your device.
  2. Then launch it and tap on the Install button next to Magisk.
  3. After that, choose ‘Select and Patch a File’, and navigate to the stock boot.img file, and select it.
    root custom rom
  4. Then tap on the Let’s Go button situated at the top right.
    root custom rom
  5. The boot.img file will now be patched and placed under the Downloads folder on your device. You should transfer this file to the platform-tools folder on your PC. We will now be using this file to root your ROM.
    root custom rom

STEP 5: Boot Device to Fastboot Mode

  1. Now connect your device to the PC via a USB cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
    command-prompt-inside-adb
  3. Type in the following command in the CMD window to boot your device to Fastboot Mode
    adb reboot bootloader

    root custom rom

  4. To verify the Fastboot connection, type in the below command and you should get back the device ID.
    fastboot devices

    root Pixel 6A

STEP 6: Boot Device using Magisk Patched Boot.img

Now, there exist two different methods to proceed ahead. You could either directly flash the patched boot.img file [see FAQ] or temporarily boot it. The second approach is highly recommended because you could easily test if everything is working well or not. If it is, then you could proceed ahead with the permanent installation.

root custom rom

On the other hand, if things don’t go as planned and your device ends up in a bootloop/ softbrick, then just a normal reboot will fix the issue. So on that note, let’s get started with the second approach. For that, execute the below command in the CMD window and your device will be booted to a temporarily rooted OS.

fastboot boot magisk_patched.img

STEP 7: Permanent Root Custom ROM via Magisk Direct Install

After executing the above command, your device will be booted to the OS with a temporary root. Here’s how to make it permanent:

  1. To begin with, launch the Magisk Manager App.
  2. Then tap on Install > Direct Install and tap Let’s Go situated at the top-right.
    root custom rom
  3. Once done, hit the Reboot button situated at the bottom right.
  4. That’s it, your device will now boot to the rooted OS. That’s it.

This was the second method to root any custom ROM via Magisk Patched Boot.img. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

FAQs: ROM Specific Rooting Guides

While the aforementioned steps should be sufficient enough to get the job done, but you could also refer to the below ROM-specific guides and their associated videos to obtain root. We will be adding more ROMs to this list, so do keep a tab on this section at regular intervals:

Share: