APatch Root Installation Guide
APatch is a kernel-based root solution for modern Android devices. This guide covers compatibility checks, patching, installation and recovery.
CAUTION
APatch patches the kernel in boot.img. Do not patch or flash init_boot or another partition for an APatch installation, even if your device has a separate init_boot. See the official installation instructions. If you already flashed a different partition by mistake, see Uninstallation for recovery guidance.
Quick Navigation
- What is APatch
- Compatibility and Requirements
- Boot vs Init Boot
- Installation Steps
- Post-Install Security Setup
- Modules
- OTA Updates
- Troubleshooting and Recovery
Related Guides:
- Main Rooting Guide - Rooting overview and framework selection
- Bootloader Unlocking - Required first step
- Root Framework Comparison - APatch vs Magisk vs KernelSU
- General Troubleshooting
- FAQs
Understanding APatch
APatch patches the kernel in boot.img and provides kernel-level root access with systemless-style behavior.
Core Characteristics
- Kernel-space root model - root control comes from kernel-side components
- System partition remains untouched - no
/systemremount required - Separate ramdisk support - still patches
boot.imgwhen a device also has aninit_bootpartition - Module support - APModule ecosystem plus partial cross-compatibility with some other module styles
APatch vs Other Root Solutions
| Feature | APatch | Magisk | KernelSU |
|---|---|---|---|
| Architecture | Kernel-based | Userspace root stack | Kernel-based |
| Typical setup | Patch + flash boot.img | Patch + flash image | Kernel-dependent install methods |
| Module model | APModule (plus some compatibility) | Magisk modules | KSU modules |
| Zygisk-style workflow | Via community alternatives | Native | Via alternatives |
| OTA workflow | Repatch updated image | Built-in paths + manual recovery cases | Slot/image aware workflows |
CAUTION
Do not run APatch together with Magisk or KernelSU on the same active slot. Use one root stack at a time.
Compatibility and Requirements
Officially Relevant Compatibility Signals
Based on APatch upstream docs and repository notes:
- Architecture: ARM64 only
- Kernel range: Linux kernel 3.18 to 6.12 (upstream stated range)
- Kernel configuration:
CONFIG_KALLSYMS=y; see upstream requirements forCONFIG_KALLSYMS_ALLand device limitations - Kernel 6.6: upstream says it has only been tested on Xiaomi and OnePlus devices; other brands need additional verification
- Practical Android target: modern Android builds (Android 10+ is the common baseline in community usage)
Must-Have Prerequisites
ESSENTIAL REQUIREMENTS
Unlocked bootloader - mandatory before any APatch install.
Exact matching stock firmware - image must match your current build fingerprint.
Complete backup - failed flashes can force full restore.
Battery 50%+ - avoid interruptions during patch/flash.
Tools You Need
Computer:
- Android Platform Tools (latest
adb/fastboot) - OEM USB drivers (Windows)
- Image extraction tools (for payload/Firmware archives)
Device:
- Latest APatch manager from GitHub Releases
- File manager
- 500MB+ free storage
Boot vs Init Boot: What to Patch
Flashing the wrong target can prevent the device from booting.
boot.img
- Contains the kernel that APatch patches, including on devices with a separate
init_bootpartition. - Use the stock image from the exact firmware build and keep an unmodified backup outside the phone.
init_boot.img
- On devices that use it, this partition contains the generic ramdisk, not the kernel APatch patches.
- Another root method may use it, but it is not an APatch patching or flashing target.
How to Identify Correct Target
- Identify the exact model, region and firmware build in your device settings.
adb shell getprop ro.build.fingerprintcan help identify the running build. - Obtain the stock
boot.imgfrom matching firmware. Do not use an image already patched by another root manager. - Check your device-specific instructions for the supported flashing method and, if applicable, the correct slot. The presence of
init_bootdoes not change APatch's target.
SAFETY RULE
Patch a copy of the stock boot.img for the build you intend to boot, and keep the original available for recovery.
Installation Steps
Step 1: Extract the Correct Stock Image
Extract the stock boot.img from your exact current firmware build and keep an unmodified copy for recovery.
Pixel
- Download factory image from Google Factory Images
- Extract outer archive
- Extract inner
image-*.zip - Extract
boot.img
OnePlus/OPPO/Realme (payload OTA)
- Download full OTA package
- Extract
payload.bin - Use a payload dumper to extract
boot.img
Xiaomi/Redmi/POCO
- Download full fastboot ROM
- Extract archive
- Extract
boot.imgfrom theimages/directory
Samsung
Samsung often uses Odin and compressed images (*.lz4), not the generic fastboot workflow below. APatch lists support for Samsung devices with security protection as planned; check current upstream and model-specific support before proceeding.
Step 2: Patch the Image in APatch
adb push boot.img /sdcard/Download/In APatch manager:
- Open APatch and choose the option to patch a boot image
- Select the matching stock
boot.img - Set a strong SuperKey according to the manager's rules; keep it private
- Wait for patch completion and note the exact output path shown by the manager
The patched output is saved to device storage. Preserve the original stock boot.img separately.
Step 3: Test Boot First (When Supported)
Use this only if your device supports fastboot boot for its boot image. In this and the following examples, apatch_patched.img is a placeholder: replace it with the exact filename and path reported by APatch.
adb pull /sdcard/Download/apatch_patched.img ./
adb reboot bootloader
fastboot devices
fastboot boot apatch_patched.imgThis boots the image temporarily without flashing it. Check APatch in the manager before deciding whether to flash. If the test fails, investigate rather than flashing it. If your device does not support test boot, check its documented installation and recovery options before deciding whether to proceed.
Step 4: Flash Permanently
The example below is only for devices whose documented APatch installation uses fastboot. Confirm the device, build and bootloader state first. Transfer the patched output to the computer if you have not already, replacing the example path with the actual file. If Android is running, enter the bootloader:
adb pull /sdcard/Download/apatch_patched.img .
adb reboot bootloader
fastboot devicesA/B Slot Awareness
On devices that support it, check the active slot before flashing:
fastboot getvar current-slotOn standard A/B devices, unsuffixed fastboot flash commands for a slotted partition target the current active slot by default (AOSP); fastboot getvar current-slot reports the slot selected for the next boot. Use these examples only if that is the intended slot and the image matches its firmware. For a different slot, follow the exact-device procedure instead.
Use the result alongside your device's instructions to identify the correct boot slot and matching image. If explicit boot_a or boot_b targeting is required, follow the documented procedure for that device. Do not flash both slots or switch slots blindly; Samsung and some other devices use different tools.
Flash the verified image
Use the patched file made on this device, not an image made for another device or build. After confirming that the example applies to the intended slot:
fastboot flash boot apatch_patched.img
fastboot rebootVERIFIED BOOT NOTE
Do not disable AVB as a default APatch setup step. APatch workflows are designed to operate without broadly disabling verification.
Step 5: Verify Root
- Boot may take longer on first startup
- Open APatch manager and confirm installed status
- Validate shell root:
adb shell
su
idExpected output includes uid=0(root).
Post-Installation Setup
Recommended Security Baseline
In APatch settings:
- Default SU action: prompt
- Short prompt timeout (for accidental requests)
- Biometric or device authentication for approvals
- Enable root access logs
Root Permission Hygiene
- Grant only to trusted apps
- Revoke old/unused grants regularly
- Check logs after new module installs
Manager Hiding and Sensitive Apps
If your build supports manager hiding/repackaging, use it carefully and test critical apps one-by-one after changes.
Managing Modules
Module Reality Check
- APatch module support changes quickly
- Not every Magisk or KernelSU module is compatible
- Start with well-maintained modules with recent updates
Safe Module Workflow
- Install one module at a time
- Reboot and test system stability
- Keep a known-good boot image for rollback
- Avoid stacking many behavior-changing modules at once
If a Module Causes Boot Problems
- Try APatch's module rescue procedure to disable modules.
- If that does not work, follow your device's recovery instructions to restore the matching stock
boot.imgto the affected slot. See Uninstallation if a different partition was also flashed. - Once the device is working, use the documented recovery or manager procedure to remove the problematic module. Restoring stock boot also removes active APatch root, so the manager may not be able to remove it until root is restored safely.
OTA Handling
An OTA may replace APatch's boot image. Follow your device's update instructions and keep matching stock images and a recovery plan. Some updates require the original stock boot.img to be restored before installation.
A/B Devices
- Back up your data and check the update and slot procedure for your device. Restore the current build's stock boot image first if the updater requires it.
- Install the OTA using the device's documented process and boot the updated build.
- Extract the updated build's stock
boot.img, patch it with APatch, and use the documented method to flash the correct boot slot. - Reboot and verify root; keep the updated stock boot image for recovery.
APatch also documents an inactive-slot post-OTA option, but upstream warns that it can be unstable. Use it only when the device-specific procedure and recovery options are understood.
Non-A/B Devices
- Follow the device's update instructions, restoring the current stock boot image first if required.
- After booting the updated build, extract its stock
boot.img, patch it and flash the boot partition using the device's documented method.
OTA RULE
Patch the stock boot.img for the build on the slot you intend to boot, not an image from an older or different build. Never use init_boot as the APatch target.
Root Hiding and Play Integrity
Play Integrity behavior changes frequently server-side. There is no permanent bypass guarantee.
Practical Expectations
- Basic integrity: sometimes passable with careful setup
- Device/strong integrity: commonly fails on unlocked/rooted devices
- Banking/payment app behavior varies by region, app version, and backend policy
Safer Strategy
- Keep root access denied for sensitive apps
- Use minimum module set required for your use case
- Re-test after every OTA or major app update
- Follow the module stack in Play Integrity and Banking Apps
Uninstallation
To remove a normal APatch installation, restore the unmodified boot.img matching the firmware on the affected boot slot. This removes the active APatch boot modification, but other files or settings may remain. If more than one slot was modified, each needs the stock image matching its own firmware and the device-specific recovery procedure. The following example applies only when your device's documented recovery method uses fastboot. On a standard A/B device, this unsuffixed command targets the current active slot. Use it only if that is the affected slot and the image matches its firmware; otherwise follow the exact-device recovery procedure. Replace stock_boot.img with the matching stock image:
adb reboot bootloader
fastboot flash boot stock_boot.img
fastboot rebootIf Android cannot boot, use your device's documented hardware-key or recovery procedure instead of adb reboot bootloader.
WARNING
If an APatch-patched image was previously flashed to init_boot or another partition by mistake, restoring boot alone will not repair that partition. Follow the manufacturer or device-specific recovery procedure to restore the correct stock image to every affected partition and slot, and seek help if unsure. Do not relock the bootloader until the complete firmware is restored and verified.
For a fully stock state, follow the manufacturer or device-specific instructions for restoring firmware. A working fastboot connection does not guarantee recovery.
Device-Specific Notes
Pixel
- For APatch, patch
boot.imgeven on Pixel models with a separateinit_bootpartition. - Use the factory image matching the exact device and installed build.
OnePlus/OPPO/Realme
- Extract the matching
boot.imgfrom the appropriate firmware package; many OTAs usepayload.bin. - Unlocking and recovery procedures vary by model and region.
Xiaomi/Redmi/POCO
- Patch
boot.imgfor APatch, even if the device also hasinit_boot. - Respect anti-rollback constraints. Some updates require the stock boot image first; see upstream's update notes.
Samsung
- Many models use Odin rather than standard fastboot. Upstream lists support for Samsung devices with security protection as planned.
- Unlocking or flashing custom binaries can permanently trip Knox. Use only a verified model-specific method and recovery plan.
Troubleshooting
👉 Click to expand details
Bootloop After Flash
Common causes:
- An image flashed to the wrong partition
- Image from the wrong firmware build
- Wrong slot on A/B devices
- An incompatible kernel or module
For a normal APatch installation, restore the exact-build stock boot.img to the affected boot slot using your device's documented method; see Uninstallation. If another partition was written by mistake, that partition also needs the appropriate stock image and device-specific recovery procedure. Do not relock the bootloader while modified or mismatched images remain.
APatch Fails to Patch Image
- Update APatch manager to latest stable release
- Re-extract image from original firmware package
- Verify image is not corrupted/renamed incorrectly
- Ensure enough free storage on device
fastboot Cannot Detect Device
- Update platform-tools
- Change cable/USB port
- Verify OEM unlock and bootloader mode
- Reinstall drivers on Windows
Root Lost After OTA
- Extract stock
boot.imgfrom the installed OTA build - Repatch it and flash the documented boot partition and slot
Next Steps
Start with only essential modules, and keep the stock image plus your exact build and slot notes for recovery. Browse the root apps and modules collection, ad-blocking guide, and debloating guide for common uses.
Community Resources
Official:
Project Help:
When requesting help, include:
- Device model and build number
- Android version
- APatch manager version
- Partition actually flashed (normally
boot), including any accidental changes to other partitions - Current slot (
a/b) on A/B devices - Exact error text and steps already tried