Adaway Not Working With KernelSU: How to Fix
Understanding the KernelSU and Adaway Interaction
We understand the frustration that arises when a trusted utility like Adaway fails to function correctly after switching root management solutions to KernelSU. For years, the Android rooting ecosystem relied heavily on Magisk as the de facto standard. However, KernelSU has emerged as a powerful, modern alternative based on the KernelSU kernel patching approach. While it offers superior isolation and security, it also introduces differences in how systemless modules and applications interact with the underlying operating system.
Adaway is the gold standard for system-wide ad blocking on Android. It operates by modifying the /etc/hosts file to redirect ad-serving domains to a null IP address (127.0.0.1 or ::1). Historically, this required the app to have root access to write to the system partition or, in the case of Magisk, to utilize the Magisk Module system to overlay the hosts file systemlessly.
When users migrate to KernelSU, they often find that Adaway cannot gain the necessary permissions to write the hosts file, or the changes simply do not persist after a reboot. This occurs because KernelSU manages access control differently. It does not automatically grant root access to all system apps, and it handles “mount namespaces” distinctively. Adaway relies on a su binary to execute commands as root. If KernelSU does not recognize the request or if the Hosts Module mechanism is not present, the ad-blocking process fails. We will provide a comprehensive, step-by-step solution to bridge this gap and restore seamless ad blocking.
Prerequisites for KernelSU Ad Blocking
Before attempting the fixes outlined in this guide, we must ensure your device environment is correctly configured. A mismatched kernel or missing binaries are the primary causes of failure.
- KernelSU Installed: You must have a working KernelSU installation. Check the KernelSU manager app to confirm you have root access.
- Compatible Kernel: Ensure your device is running a kernel that has been successfully patched with KernelSU. Custom kernels are often required unless you are using a GKI (Generic Kernel Image) device.
- Adaway App: Have the latest version of Adaway installed. We recommend downloading the official APK from the Adaway website or a trusted repository like Magisk Module Repository.
- Busybox (Optional but Recommended): While KernelSU often includes its own tools, having Busybox installed ensures that shell scripts used by ad blockers have access to a full suite of Unix utilities.
Fix 1: The Official KernelSU Hosts Module Method
The most robust and recommended method to make Adaway work with KernelSU is to bypass the app’s internal request for a su binary and instead rely on KernelSU’s native module system. KernelSU supports modules similar to Magisk, but the implementation differs. We will utilize a specific module designed to handle the /system/etc/hosts file.
Why the Native App Fails
Adaway tries to execute su -c "cat $hosts > /system/etc/hosts". In a KernelSU environment, the KernelSU manager might intercept this request, but the app’s fallback mechanism might fail if it specifically looks for the Magisk su path or if the SELinux context is not properly relaxed for that specific operation.
Implementing the Fix via KernelSU Modules
We will install a module that creates a writable overlay for the hosts file.
- Open the KernelSU Manager: Launch the KernelSU app on your device.
- Navigate to Modules: Tap on the Modules tab within the app.
- Install New Module: Select “Install from storage” or “Online Module” if available. However, the most reliable method is manually installing a hosts module.
- Download the Hosts Module: You need a specific Hosts Module compatible with KernelSU. You can find this in the Magisk Module Repository or community forums like XDA. Look for “KernelSU Hosts Module” or “Universal Hosts Module for KernelSU”.
- Flash the Module: Select the downloaded zip file. KernelSU will flash it.
- Reboot: A reboot is mandatory for the kernel to load the new module overlay.
- Configure Adaway: Open Adaway. Go to Preferences -> Root-based ad blocking. Ensure the “Use backup method” is unchecked. Adaway will detect that it cannot write to the file directly, but it can still read the file.
- Update Sources: Tap “Update sources” in Adaway. The app will download the lists. Since we are using a Hosts Module, Adaway technically does not need to write the file anymore. However, Adaway has a feature where it can generate the hosts file and then “apply” it. In this context, “Applying” might fail, but the module handles the mounting.
Note: Some users prefer to use Adaway solely as a source generator. You can use Adaway to download the lists, export the resulting hosts file to a location like /sdcard/hosts, and then manually place that file into the KernelSU module directory via a root explorer. However, the module method is automated and preferred.
Fix 2: The Systemless Hosts Solution (The “Magisk” Way)
If you are using KernelSU alongside Magisk (dual boot patching is rare, but some users switch back and forth), or if you are using a KernelSU fork that maintains Magisk compatibility, you can use the Magisk Systemless Hosts module.
However, pure KernelSU users should look for the “Systemless Hosts” logic adapted for KernelSU. This usually involves a custom module that mounts a new hosts file over the system default.
Crafting a Custom KernelSU Module for Adaway
If you cannot find a pre-built module, we can guide you on the structure required to make Adaway work manually. This requires creating a simple zip file that KernelSU can flash.
- Create the Structure:
- Create a folder named
AnyName. - Inside, create
module.prop. - Inside, create a folder structure:
system/etc/.
- Create a folder named
- The
module.propFile:id=hosts_modulename=Hosts Moduleversion=1.0versionCode=1author=YourNamedescription=Redirects system-wide ads
- The Hosts File:
- Run Adaway on your device.
- Tap “Your lists are up to date”.
- Tap “Export to SD Card”.
- Locate the exported
hostsfile. - Copy this file into your
system/etc/folder inside your module structure.
- Zip and Flash: Zip the
AnyNamefolder and flash it via KernelSU.
This method is manual but ensures that Adaway never needs to touch the system partition. It simply acts as a manager for the file you manually create.
Fix 3: Adjusting SELinux and Access Control Policies
KernelSU is stricter than traditional root solutions regarding SELinux contexts. Adaway may fail to execute the mount command or write to the temporary directory because the process context is not allowed.
Checking SELinux Status
- Open a terminal (Termux).
- Type
getenforce. - If it returns
Enforcing, we need to be careful.
Using KernelSU DenyList / Superuser Rules
- Go to the Superuser tab in KernelSU.
- Find Adaway in the list.
- Check if it has root access granted.
- Crucial Step: Tap on the Adaway entry to configure settings.
- Mount Namespace: Ensure that “Mount Namespace” is toggled on or off depending on the app’s requirement. For Adaway, it often requires seeing the full system view to modify the hosts file. We recommend enabling “Override KernelSU Context” if available in your version of KernelSU.
- SELinux Context: Some KernelSU versions allow you to set SELinux to
Permissivespecifically for the app. This is a powerful troubleshooting step. Grant Adaway this permission temporarily to see if it resolves the “Apply” issue.
Warning: Running apps in permissive mode can be a security risk. Only do this to verify the fix. If it works, you should revert to Enforcing and rely on the Hosts Module method (Fix 1).
Fix 4: The “Magisk Daemon” Replication Technique
A common reason Adaway fails on KernelSU is that it waits for the Magisk daemon to be active. KernelSU does not have a “Magisk daemon,” but it has its own ksud binary.
Symlinking the Binary
Some users have reported success by creating a symbolic link from the KernelSU binary to the location where Adaway expects the Magisk su binary.
- Locate KernelSU Binary: Usually located at
/data/adb/ksu/bin/ksudor/system/bin/ksud. - Create Symlink:Note: This is a hack and may break with kernel updates. It is better to patch the Adaway app itself to look for
su mount -o rw,remount /system ln -s /data/adb/ksu/bin/su /system/bin/su mount -o ro,remount /systemksud, but that requires recompiling the APK.
Instead of symlinking, we should ensure Adaway is actually calling the correct binary. If you open the Adaway logs (inside the app settings), you might see “Command failed”. This indicates the shell command su is not found or permission denied.
Alternative Approach: Use a Terminal Emulator
- Open Termux.
- Run
su. - Run the command that Adaway is failing to run manually. Usually, this is:
cat /data/data/org.adaway/files/hosts > /system/etc/hosts - If this command works manually in the terminal, the issue is purely within the Adaway app’s automation script. You can then rely on the manual export method described in Fix 2.
Fix 5: Using Alternative Ad Blockers Compatible with KernelSU
If Adaway continues to be stubborn, we should consider using an ad blocker that is native to the KernelSU ecosystem. KernelSU allows for more advanced kernel-level filtering.
Rethink DNS
While not a root ad blocker, Rethink DNS is an excellent open-source app that runs a local VPN to block ads. It does not require root, but if you have root, it can use KernelSU to intercept traffic more efficiently via a local DoH/DoT server.
AdGuard
AdGuard has a root version. However, it is proprietary.
Hosts-based Manual Management
If you want to stick to Adaway but simplify the process:
- Use Adaway to download lists.
- Export the
hostsfile. - Use a file manager with root access (like MiXplorer or Root Explorer).
- Navigate to
/data/adb/modules/. - Create a folder
my_hosts. - Inside, create
system/etc/hosts. - Paste the content from your exported file.
- KernelSU will mount this over the system hosts file immediately without a reboot (usually).
Troubleshooting Common Errors with KernelSU and Adaway
We will address specific error messages users encounter when trying to get Adaway working with KernelSU.
“Root Access Denied”
This is the most common error. KernelSU acts as a firewall for root requests. If Adaway is not listed in the Superuser log, it hasn’t requested access.
- Solution: Force stop Adaway and clear its cache. Open it again. It should trigger a KernelSU popup requesting root. If no popup appears, KernelSU might be hiding from the app. Check KernelSU Settings -> Superuser -> Automatic Reveal.
“Read-only File System”
This happens when KernelSU has mounted the system partition as Read-Only to protect integrity.
- Solution: This is a strength of KernelSU. Do not try to remount the real system partition. Instead, rely entirely on the module overlay method (Fix 1). The overlay is a virtual file system that KernelSU allows you to write to.
“Update Failed: Could not download sources”
This is an Adaway network error, not a root error.
- Solution: This usually happens because the Adaway app is being blocked by its own ad-blocking rules (self-blocking). You must temporarily disable Adaway or allow the Adaway app through the firewall/VPN to let it download the lists from the external servers. Once downloaded, re-enable ad blocking.
Advanced: Compiling a Kernel with Built-in Hosts Support
For the absolute power user, we can modify the kernel source code to include a default hosts file that is immutable and updated via a script. However, this is overkill for 99% of users and is not recommended unless you are building custom ROMs.
The standard, stable solution remains the Hosts Module approach. It utilizes the KernelSU architecture exactly as intended: modifying the system partition virtually, without touching the actual read-only partitions.
Summary of the Recommended Workflow
To ensure Adaway functions perfectly with KernelSU, we recommend the following workflow to our users:
- Do not rely on the “Apply” button inside Adaway. Treat Adaway as a lists generator.
- Install a Hosts Module for KernelSU. Search the Magisk Module Repository for “KernelSU Hosts”.
- Configure Adaway to export. Set Adaway to export the list to a file.
- Manual Update (if needed). If the module does not auto-update, use a script or a file manager to copy the exported hosts file to the module directory.
By decoupling the ad-blocking enforcement (the Module) from the list generation (the App), you create a stable system that respects KernelSU’s security model.
Conclusion
KernelSU represents the evolution of Android root management, prioritizing security and kernel integrity. While this shifts away from the “everything is root” philosophy of older systems, it does not mean we lose access to essential utilities like Adaway. By understanding the interaction between user-space apps and kernel-space modules, we can adapt our methods.
The failure of Adaway is not a bug in the app, but a difference in environment. We have demonstrated that with the correct Hosts Module and a slight adjustment in how we view the app’s role, you can enjoy a completely ad-free experience on KernelSU.
We advise users to always download modules from trusted sources. The Magisk Module Repository remains a vital resource for these tools. Ensure you keep your KernelSU manager updated, as the team frequently patches bugs related to module mounting and superuser requests. With these steps, your device will be clean, fast, and ad-free.