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 theinit_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.
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:
- Head over to Settings > System > About Phone > Tap on Build Number 7 Times.
- Then go back to Settings > System > Developer Options < Enable USB Debugging.
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.
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
- Now download and install the latest version of APatch on your device.
- After that, launch it and tap on the Install icon situated at the top right.
- Then choose Select a Boot Image to Patch and choose the stock boot.img.
- Now tap on Set SuperKey, set your key, and hit OK. Do not use weak keys like 1234abcd.
- Moreover, the length of Superkey should be at least 8 characters, in alphanumeric format.
- APatch will patch the boot.img and place it inside the Downloads folder.
Boot to Fastboot Mode
- Type in CMD in the platform-tools folder address bar and hit Enter.
- This will launch Command Prompt. Type in the below command in it
adb reboot bootloader
- This will boot your device to the Fastboot Mode, verify the same via:
fastboot devices
- 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
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]
- Type in the below command to permanently flash the patched boot:
fastboot flash boot apatched_boot.img
- Now reboot your device to the rooted OS via the below command:
fastboot reboot
- After that, launch APatch and tap on SuperKey.
- Now enter the Superkey that you had set earlier up.
- You will get the Working status under Kernel Patch.
- So hit Install next to AndroidPatch and restart the device.
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].
- First off, type in the below command to boot your device to TWRP:
adb reboot recovery
- Then go to Install > tap on Install Image > select the patched boot.
- Now choose the Boot partition and perform a right swipe to flash it.
- Finally, go to Reboot > System. Device will reboot to the rooted OS!
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!
- Download
kptools-win.zip
,kpimg-android
andmagiskboot
: LINK - Then extract all these three files to the same folder.
- Now open Command Prompt inside that folder and type in the below command:
magiskboot.exe unpack boot.img
- This will unpack the
boot.img
and give you the kernel file. Rename it to kernel-b. - 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
- Finally, type in the below command to repack the boot.img:
magiskboot.exe repack boot.img
- You’ll get a new patched image named new-boot.img.
- 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:
- First off, download and install the OTA update that you have got.
- Once the download is complete, DO NOT RESTART your device.
- Instead, launch APatch and tap on the Install button at the top right.
- Now select Install to Inactive Slot [After OTA] and that’s just about it.
Flashing Modules via APatch
- First off, download the desired module ZIP file on your device.
- Then launch Apatch, go to APModule, and tap on the load icon.
- Select the module ZIP and it will be flashed. Once done, hit Reboot.
- 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:
- To begin with, download the latest version of APatch from here.
- Then launch APatch and tap on the Install icon at the top right.
- Choose Patch and Install. Type in the SuperKey and tap on Start.
- It will now patch and flash the latest APatch build on your device.
- 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:
- Launch APatch and go to the SuperUser section.
- Then enable the toggle next to the desired apps.
- Launch the app and it will have root permissions.
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:
- Launch APatch, go to Modules, and disable/uninstall all the modules
- Go back to the app’s home screen and tap on Uninstall > Uninstall All.
- APatch will be removed and your device will reboot to non-rooted OS.
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.