How to Root Android via APatch, Install Module, Give SU Access

root apatch

root apatch

In this guide, we will show you the steps to root your Android device via APatch. We are witnessing quite a few new rooting solutions coming up in recent times. It all started with SuperSU, then came Magisk, and there has been no looking back ever since. With the ease of patching the boot/init_boot and the ability to flash modules in just a couple of clicks, it’s not hard to see the reason behind its rise to fame.

With that said, Magisk isn’t the only player out there in the open, and many new and intriguing methods are making their presence felt, with the likes of Magisk Kitsune, KernelSU, and APatch being some of the most popular players in town. As far as this guide is concerned, we will make you aware of the steps to root your device via APatch. But first, let’s try and understand what exactly this tool is, how it functions, and what are some of the nifty functionalities that it beholds.

What is APatch

APatch is a kernel-based root solution for Android devices that works in kernel mode and grants root privileges to user space apps directly in kernel space. This is similar to how KernelSU functions and the similarity doesn’t end there. The APatch UI and the APModule source code have also been derived and modified from KernelSU itself. With that said, let’s now turn our attention toward the various features that APatch has in its arsenal:

Features of APatch

  • It is compatible with most Android devices. Unlike KernelSU, it is not just limited to devices with GKI kernel, which automatically translates to its long checklist of supported device lists. This is because most Android devices still have a QGKI kernel which automatically negates the support for KernelSU, which fortunately isn’t the case with APatch as it supports both QGKI as well as GKI Kernels
  • It also comes with a SuperKey mechanism- a digit alphanumeric code that further strengthens the security of your rooted device.
  • Similar to Magisk, you can easily patch the stock and init_boot files.
  • Likewise, doing a Direct Install for root updates or making root permanent is a breeze.
  • You can also retain root while installing OTA updates using a method built into APatch.
  • Supports APModule (APM) similar to Magisk modules.
  • Supports KPModule (KPM), which will allow you to inject any code into the kernel
  • APatch depends on KernelPatch.

Drawback of APatch

APatch has one major drawback- it is unable to patch the init_boot file for root. As a result of this, all devices that came with Android 13 or higher versions out of the box might not be supported by APAtch, at least at the time of writing this article. In this regard, here’s what the developers have to say:

APatch always patches the boot.img of any device. Do not attempt to patch or flash the init_boot or other partition image files. The APatch developers are not responsible for the failure of resulting patch and boot.

With that said there are still a plethora of devices that ship with Android 12 or old versions and for them, APatch might be the preferred approach to root their device. So without further ado, let’s see how this could be carried out.

How to Root Android via APatch

Before starting, please take a backup of all the data on your device to be on the safer side. Thedroidwin will not be held responsible if something happens to your device and data after performing the below steps:

Prerequisites

  • Your device should have an ARM64 architecture. You can take the help of a third-party app named Treble Info to verify the same. So download and install it > Then launch it > Go to Details > Refer to the CPI Architecture section > Make sure it’s ARM64.
  • Your device’s Kernel version should be between 3.18 and 6.1. You can verify the same from Settings > About Phone or System section. Or simply search kernel in the Settings menu.

NOTE: If your Android device checkmarks the aforementioned two prerequisites then you’ll be able to root it via APatch, however, if you want to further cement this fact, you’ll then have to obtain temporary root via Magisk, KernelSU, or Kitsune [or permanent root and then remove it after getting the job done] and then execute the below command to verify the result.

zcat /proc/config.gz | grep -w CONFIG_KALLSYMS

Android SDK Platform Tools

First off, get hold of Android SDK Platform Tools and extract it to any convenient location on your PC.

android sdk platform tools

Enable USB Debugging and OEM Unlock

Next up, you’ll have to enable USB Debugging so that your device is recognizable by your PC in ADB Mode. Likewise, enabling OEM Unlocking is required to unlock the bootloader on your device. So make sure to enable both these toggles as instructed below:

  1. Head over to Settings > System > About Phone > Tap on Build Number 7 Times.
  2. Then go back to Settings > System > Developer Options < Enable USB Debugging.usb debug oem unlock

Unlock Bootloader

You’ll also have to unlock the bootloader on your device. Do note that doing so will wipe off all the data and might make the warranty null and void as well. If that’s well and good, then you can refer to our guide on How to Unlock Bootloader on any Android Device.

Convert OnePlus 12 from ColorOS to OxygenOS

Get Boot.img

Download the same version of stock firmware that is currently installed on your device. Then extract it to your PC, get hold of the stock boot.img, and transfer it to your device.

Pixel: Download Factory Image and extract the ZIP.
OnePlus: Download Full Firmware > Extract payload.bin via Fastboot Enhance.
Xiaomi: Download Fastboot ROM > Extract TGZ and TAR via 7ZIP > Go to Images.

 

Patch Boot.img via APatch

  1. Now download and install the latest version of APatch on your device.
  2. After that, launch it and tap on the Install icon situated at the top right.
  3. Then choose Select a Boot Image to Patch and choose the stock boot.img.root apatch
  4. Now tap on Set SuperKey, set your key, and hit OK. Do not use weak keys like 1234abcd.
  5. Moreover, the length of Superkey should be at least 8 characters, in alphanumeric format.
  6. APatch will patch the boot.img and place it inside the Downloads folder. root apatch

Boot to Fastboot Mode

  1. Type in CMD in the platform-tools folder address bar and hit Enter.
  2. This will launch Command Prompt. Type in the below command in it
    adb reboot bootloader

    kernelsu root android

  3. This will boot your device to the Fastboot Mode, verify the same via:
    fastboot devices
  4. If you don’t get any device ID, then install Fastboot Drivers on the PC.

Now there exist four different methods that you can opt for: Temporary Root, Direct Permanent Root, Via Custom Recovery, and Manually Patching the Kernel. We have listed all these four methods below, you may try out the one that is in sync with your requirement.

Temporary Root via APatch

The biggest benefit of this method is that you can temporarily boot the patched boot.img file and verify if it’s working well and good or not. If it is, then your device will boot to the rooted OS and you can then make the root permanent via the second method given below. On the other hand, if there’s any issue with the patched boot.img, then you just need to do a reboot.

The OS will replace the patched boot with the stock one and your device will be up and running again. However, do note that not every device supports temporary boot. If that is the case with your device as well, then you’ll have to opt for the permanent root or any of the other two methods. With that said, type in the below command to temporarily boot your device to the rooted OS via the APatched boot.img

fastboot boot apatched_boot.img

root apatch

If everything’s working well and good and your device is booted to the OS, then boot your device back to Fastboot Mode and then refer to the next method to make the root permanent.

Permanent Root via APatch

The benefit of this method is that it’s supported across all Android devices. On the flip side though, you cannot test if the patched file is correct or not, your only way out is to directly flash it. If there’s something wrong with the file, your device will end up in a bootloop. To rectify it, you’ll have to flash the stock boot.img file [via fastboot flash boot boot.img]. On that note, let’s get started with the rooting process:

[NOTE: The below steps are applicable for both the set of users- those who are directly starting with the Permanent Root as well as those who are coming from the Temporary Root method]

  1. Type in the below command to permanently flash the patched boot:
    fastboot flash boot apatched_boot.img

    root apatch

  2. Now reboot your device to the rooted OS via the below command:
    fastboot reboot
  3. After that, launch APatch and tap on SuperKey.
  4. Now enter the Superkey that you had set earlier up.
  5. You will get the Working status under Kernel Patch.
  6. So hit Install next to AndroidPatch and restart the device.root apatch

APatch Root Via Custom Recovery

If your device supports custom recovery, then the entire rooting process will be quite easy to carry out. Here’s how it can be done [Having issues installing TWRP? Check out this guide: How to Install TWRP Recovery on Android].

  1. First off, type in the below command to boot your device to TWRP:
    adb reboot recovery
  2. Then go to Install > tap on Install Image > select the patched boot.
  3. Now choose the Boot partition and perform a right swipe to flash it.
  4. Finally, go to Reboot > System. Device will reboot to the rooted OS!reboot system twrp

APatch Root By Manually Patching the Kernel

This is the most difficult of the four methods and should only be tried if you are looking to challenge your inner geek!

  1. Download kptools-win.zipkpimg-android and magiskbootLINK
  2. Then extract all these three files to the same folder.
  3. Now open Command Prompt inside that folder and type in the below command:
    magiskboot.exe unpack boot.img
  4. This will unpack the boot.img and give you the kernel file. Rename it to kernel-b.
  5. Now type in the below command in the CMD window to patch the kernel:
    kptools-x86_64-win.exe -p --image kernel-b --skey "YourKey" --kpimg kpimg-android --out kernel
  6. Finally, type in the below command to repack the boot.img:
    magiskboot.exe repack boot.img
  7. You’ll get a new patched image named new-boot.img.
  8. Flash it via the instructions given in the Temporary Boot, Permanent Root, ‘or’ Custom Recovery section.

Install OTA Updates and Retain Root via APatch

Similar to Magisk, APatch also allows you to install OTA updates on your device and then retain root. Here’s how it could be done:

  1. First off, download and install the OTA update that you have got.
  2. Once the download is complete, DO NOT RESTART your device.root apatch
  3. Instead, launch APatch and tap on the Install button at the top right.
  4. Now select Install to Inactive Slot [After OTA] and that’s just about it.

Flashing Modules via APatch

  1. First off, download the desired module ZIP file on your device.
  2. Then launch Apatch, go to APModule, and tap on the load icon.root apatch
  3. Select the module ZIP and it will be flashed. Once done, hit Reboot.
  4. Your device will reboot to the OS and the module will be activated.

Update APatch

If your device has recently received the latest APatch update, then here’s how to download and install the same:

  1. To begin with, download the latest version of APatch from here.
  2. Then launch APatch and tap on the Install icon at the top right.
  3. Choose Patch and Install. Type in the SuperKey and tap on Start.root apatch
  4. It will now patch and flash the latest APatch build on your device.
  5. Once done, restart your device for the changes to come into effect.

How to Give SuperUser Access to Apps via APatch

In the case of Magisk, if you have installed a rooted app, then you’ll straightaway be greeted with the SuperUser prompt. You then just have to tap Grant and the app will get the required elevated permission. This in turn will allow it to function in the rooted environment without any issues. However, that isn’t the case with APatch. If you have rooted via APatch or KernelSU for that matter, then you will not get any SuperUser request when you launch a rooted app. Instead, you’ll have to manually grant each app the root privileges from within APatch itself. Here’s how it could be done:

  1. Launch APatch and go to the SuperUser section.
  2. Then enable the toggle next to the desired apps.
  3. Launch the app and it will have root permissions.root apatch

Do note that you will still not get any SU prompt, as soon as you launch the app after enabling its toggle in APatch, the former will atomically get the administrative privileges via APatch in the backend.

Remove Root via APatch

If you wish to go back to the non-rooted  ecosystem or rather looking to switch from Apatch to any other roofing solution, then here’s what you can do:

  1. Launch APatch, go to  Modules, and disable/uninstall all the modules
  2. Go back to the app’s home screen and tap on Uninstall > Uninstall All.
  3. APatch will be removed and your device will reboot to non-rooted OS.root apatch

That’s it. These were the steps to root your device via APatch. Likewise, we have also listed the steps to flash modules, install OTA update and retain root, and update rooted binaries. 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 as soon as possible.


Leave a Reply

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