[DEV] APatch - an alternative root solution to KernelSU and Magisk (2025)

The patching of Android kernel and Android system.

  • A new Kernel-based root solution for Android devices.
  • APM: Magisk module like support
  • KPM: Kernel Patch Module support. (Allow you to inject any code into the kernel, Kernel function inline-hook and syscall-table-hook is available)
  • APatch relies on KernelPatch

The source code for both APatch UI and APM has been copied and modified from KernelSU

What is APatch?​

APatch is a root solution similar to Magisk or KernelSU that unites the best of both. It combines Magisk's convenient and easy install method through boot.img with KernelSU's powerful kernel patching abilities.

What's the difference between APatch and Magisk?​

  • Magisk modifies the init system with a patch in your boot image's ramdisk, while APatch patches the kernel directly.

APatch vs KernelSU​

  • KernelSU requires the source code for your device's kernel which is not always provided by the OEM. APatch works with just your stock boot.img.

APatch vs Magisk, KernelSU​

  • APatch allows you to optionally not modify SELinux, this means that the APP thread can be rooted, libsu and IPC are not necessary.
  • Kernel Patch Module provided.

What is Kernel Patch Module?​

Some code runs in Kernel Space, similar to Loadable Kernel Modules (LKM).

Additionally, KPM provides the ability to do inline-hook, syscall-table-hook in kernel space.

For more information, see How to write a KPM

Relationship between APatch and KernelPatch​

APatch depends on KernelPatch, inherits all its capabilities, and has been expanded.

You can install KernelPatch only, but this will not allow you to use Magisk modules, and to use superuser management, you need to install AndroidPatch and then uninstall it.

Learn more about KernelPatch

What is SuperKey?​

KernelPatch adds a new system call (syscall) to provide all capabilities to apps and programs in userspace, this syscall is referred to as SuperCall. When an app/program tries to invoke SuperCall, it needs to provide an access credential, known as the SuperKey. SuperCall can only be successfully invoked if the SuperKey is correct and if it's not the caller will remain unaffected.

How about SELinux?​

  • KernelPatch doesn't modify the SELinux context and bypasses SELinux via a hook. This allows you to root an Android thread within the app context without the need to use libsu to start a new process and then perform IPC. This is very convenient.
  • In addition, APatch directly utilizes magiskpolicy to provide additional SELinux support.

Requirement​

Kernel configs

  • CONFIG_KALLSYMS=y
  • CONFIG_KALLSYMS_ALL=y
  • DEBUG_KERNEL=y
  • CONFIG_KALLSYMS_ALL=n (Next version of KernelPatch will support)

We don't advocate using any unofficial APatch downloads, and we don't accept any bugs feedback with using unofficial version. We only advocate downloading the latest APatch from the official channels of github release, github action, and Telegram. APatch that does not accept feedback includes but is not limited to: Third-party modify version, unofficial channel distribution of unofficial version. The latest official beta is 10916(as of August 31,2024) . If you are using the unofficial APatch mentioned above, please do not report to the official telegram group if you get the bug. At the same time, feedback requires video or screenshots and logs, otherwise we can only give you a random guessing.

[DEV] APatch - an alternative root solution to KernelSU and Magisk (1)

GitHub - bmax121/APatch at akpatch.org

The patching of Android kernel and Android system. Contribute to bmax121/APatch development by creating an account on GitHub.

[DEV] APatch - an alternative root solution to KernelSU and Magisk (2)github.com

Official telegram group
Discussion: https://t.me/apatch_discuss
Update channel: https://t.me/APatchChannel

Known issue
According to our tests, Google Pixel devices using Tensor chips and Android 14 may encounter an issue after being updated to the August security patch where the kernel cannot be patched. If you are experiencing this problem with a Google Pixel device using Tensor chips, please do not feedback temporarily and roll back to the July security patch or manually patch the kernel in other ways.

FAQ​

Q1: Can APatch use Magisk modules?​

Supports APModule (APM) similar to Magisk modules.

Supports KPModule (KPM), which allows to inject any code into kernel (Provides kernel function inline-hook and syscall-table-hook).

Q2: What is the difference between APatch and KernelSU?​

KernelSU requires your device's kernel source code, which is not always provided by the OEM. APatch only need your stock boot.img.

Q3: What is a KPModule?​

KPM is a module that runs in kernel space and allows code to execute in kernel space, similar to Loadable Kernel Modules (LKM).

Additionally, the KPM provides the ability to execute inline-hook and syscall-table-hook in kernel space.

Please read How to write KPM for more information.

Q4: How to install kpm?​

There are 3 ways to use KPM: Embed, Load, and Install.

ABOUT "INSTALL"
This document was last updated on 2024-08-06 at 19:14. Caution should be exercised when accessing the contents of this page if the time difference from the present is too great.
Currently, APatch has not implemented the "Install" function for KPMs, and you can only use KPMs via "Embed" and "Load". KernelPatch and APatch's developers are working quickly to implement the "Install" function. Please wait patiently.

Embed​

Embed is a function that embeds KPMs directly into the kernel. KPMs installed by this way will be merged together with patched kernel into boot.img, and will be loaded at the boot stage pre-kernel-init.

The Embed of KPMs can be done both at first patching boot.img and after installation of APatch.

Embed KPMs at first patching​

  1. Patch your boot.img by following the Automatically patching guide. After completing step 4, do not proceed to the next step immediately.
  2. Click the "Embed KPM" button, and select the KPM you want to embed (The suffix name of KPM files is .kpm).
  3. Confirm that the KPM is the KPM you want to embed.
  4. Complete the rest of the steps in the "Automatically patching" guide, and it will be done.

Embed KPMs after installation of APatch​

After installing APatch, the way of embedding KPMs is familiar to installing APMs. You can click the button in the lower right corner and choose "Embed". The remaining steps can be referred to in Embed KPMs at first patching.

Load​

Load is a function that lets the kernel load KPMs directly. KPMs installed this way will be loaded immediately. However, all Loaded KPMs will be lost after the next reboot.

The way of Load KPMs is familiar to installing APMs; the only difference is that you do not need to reboot your device after Loading KPMs.

Install​

ATTENTION
KernelPatch and APatch have not yet implemented the "Install" function for KPMs. All descriptions below are speculative and describe the expected behavior of "Install" for KPMs.
Install is a function that installs KPMs similar to APM files into /data/adb/kpmodules or any similar directories. KPMs installed by this way can be loaded during special events. NOTE: You should always first Load a kpm to ensure it won't cause issues on your device. Once confirmed, then you can Embed it so it persists across reboots.

Where do I find the SuperKey?​

You don't find the SuperKey; you create it. If it's the first time you're opening the APatch app, and you see the below screen:

[DEV] APatch - an alternative root solution to KernelSU and Magisk (3)

Do I patch boot or init_boot?​

How do I install Shamiko/What version of Shamiko is supported?​

First, see here. That being said, an older version of Shamiko can be used with APatch (the newest is 0.7.4), and if using the shamiko_helper kpm (which can be found in the APatch TG Group files), along with a specific version of Zygisk Next (1.0.2 ONLY), then it is possible to "trick" Shamiko into detecting APatch as KernelSU, and 1.0.x versions of Shamiko can be used (versions 1.1+ have a different compression method and will not install in APatch).

The bottom line is that Shamiko would either need to directly add support for APatch, or communicate with the APatch devs what is needed for APatch to support it. Neither of those scenarios is likely, so it's better to just not use Shamiko.

If I can't use Shamiko, then how can I hide root?​

Using Zygisk Assistant or Cherish Peekaboo (see below).

What is Cherish Peekaboo?​

Cherish Peekaboo is a closed-source kpm (originally developed by GarfieldHan, part of the APatch dev team) that was designed to automatically hide APatch and LSPosed mounts. Version 1.3.1_test also solves the "Abnormal Environment" detection in Native Test v25 (Minotaur). Version 1.4.2 solves "Abnormal Environment" in Holmes 1.0 (but brings back the detection in Minotaur). These releases can be downloaded in the APatch Telegram group (filenames: cherish_peekaboo_1.3.1_test.kpm, cherish_peekaboo_1.4.2.kpm)

What is a CI build, and how do I access it?​

Continuous Integration (CI) builds refer to the automatic builds run in the official APatch Github repo. Every commit that is merged to the repo will trigger a new build. These builds should be considered Beta releases, and as such, may have issues or bugs that need to be fixed. Each new build is posted to the Telegram channel by Apatch_bot. If you would like to download the builds directly from Github, first make sure that you are logged in to Github (otherwise the build artifacts will not be displayed for download). Then open the APatch repo, and go to the "Actions" tab. Click on the name of the job in the list to see the artifacts (in this case, zips) that are associated with each CI run. There will be a "debug" zip and a "release" zip. If you would like to help test, and provide logs if issues are found, then install the "debug" version. If you just want to try out the latest bleeding edge build for yourself, then the "release" version is fine.

NOTE: If you already have a Github Actions link for the artifact that you want to download, but don't want to login to Github, you can alternatively use nightly.link.

How do I know what version the CI builds are? They all seem to start with the same number?​

The numbering convention for CI builds is based on the most recent stable release. For example, if the last stable release is build 10763, then all CI builds after it will start with that build number, and increment it in the latter part of the filename for each merged commit afterwards. Stable release filename: APatch_10763_10763-release-signed.apk First CI build after release filename: APatch_10763-3-gc309991_10766-release.apk In the above filename, "10763" is the last stable release, "3" is the number of commits merged since that release, and "10766" is the current build version (10763+3=10766).

This is the naming convention for all CI builds.

Can I use both KernelSU and APatch together? If so, how?​

It is technically possible, but not recommended. Both root solutions are complete, so there is no need to use them together.

How do I solve the root detection in Native Test/Native Detector/Hunter/Securify/Memory Detector/Holmes or whatever new detection app comes out?​

If your software is working properly, don't worry too much about the detection software.

How do I get out of a bootloop after installing an APModule?​


Useful module
PlayIntegrityFix
ZygiskNext
Zygisk_mod (open source alternative to ZygiskNext)
Zygisk Assistant
Tricky Store
adguardcert - allows using AdGuard's HTTPS filtering for all apps
Pixelify - enables pixel exclusive features and ui
Framework patcher go - for passing local attestation (Do not use with playintegrityfix)
LSposed Fork
Hide my applist
Cherish peekaboo - for hiding root (support aptach until ver 10933)

[DEV] APatch - an alternative root solution to KernelSU and Magisk (2025)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Lilliana Bartoletti

Last Updated:

Views: 6636

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Lilliana Bartoletti

Birthday: 1999-11-18

Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

Phone: +50616620367928

Job: Real-Estate Liaison

Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.