Adaway: Doesn't work on Android Nougat 7.0 without additional commands

Created on 13 Jun 2016  Â·  44Comments  Â·  Source: AdAway/AdAway

After being granted root access on Android N Preview 3 Nexus 9 64bit, it fails with this in the log for SuperSU:

AdAway @ 06/13 03:47 PM

echo Started
Started
rm -f /system/etc/hosts 2>&1

echo F*D^W@#FGF 0 $?
rm: /system/etc/hosts: Read-only file system
F*D^W@#FGF 0 1
dd if=/data/user/0/org.adaway/files/hosts of=/system/etc/hosts 2>&1

echo F*D^W@#FGF 1 $?
dd: /system/etc/hosts: Read-only file system
F*D^W@#FGF 1 1
cat /data/user/0/org.adaway/files/hosts > /system/etc/hosts 2>&1

echo F*D^W@#FGF 2 $?
F*D^W@#FGF 2 1
sush: <stdin>[8]: can't create /system/etc/hosts: Read-only file system

exit 0

Additional Information

Device: Nexus 9
Android Version: N Preview 3
Build Number: NPD35K
SuperSU version: 2.74-2

Most helpful comment

On the Nexus 9 I symlinked to /su/etc/hosts using an edited version of the commands above and it worked great, no errors at all.
Just keep the hosts target set to default (/system/etc/hosts), and I ran this in Terminal Emulator:

su -
mount -orw,remount /system
rm /system/etc/hosts
ln -s /su/etc/hosts /system/etc/hosts
mount -oro,remount /system

All 44 comments

Well it's logical if the file is read only...
Try rebooting the phone. It should be remounted in rw then.

After reboot nothing changes, still says read-only file system.

Not an adaway issue. You don't have write access to your system. Find a
root thread that will either use systemless root and flash the systemless
script in the AdAway xda thread or get rw access to your system. Adaway has
always had these as prerequisites for it to do its job.
On Jun 13, 2016 20:23, "Jsilvermist" [email protected] wrote:

After reboot nothing changes, still says read-only file system.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Free-Software-for-Android/AdAway/issues/770#issuecomment-225747508,
or mute the thread
https://github.com/notifications/unsubscribe/ADc_mNHzGk-whKAMbX_r-FtrOUrPLAF0ks5qLfRmgaJpZM4I0sb2
.

I have SuperSU systemless root installed and working properly.

Using Root Explorer I am able to go in and manually edit /system/etc/hosts and save changes.

When I open SuperSU, AdAway is granted root access, so I fail to see how this is not an AdAway issue.

I don't see how AdAway + systemless root would be able to work together, as AdAway still modifies /system files.
Did you try a system root on that device? How does AdAway behave in that configuration?

I'm not sure about a traditional system root at the moment, but I know that this same configuration worked on Marshmallow, mind you the moment you edit the system partition the certification for ota's fails, but AdAway worked fine.

Take a look on following thread:
http://forum.xda-developers.com/showthread.php?t=2190753

It implies that you need this zip in systemless root:
https://www.androidfilehost.com/?fid=24438995911977059

http://www.xda-developers.com/android-n-testers-heres-why-your-root-apps-keep-failing/
I think this is the issue, and if you install busybox, this should work with no issues: https://github.com/sanjay900/AdAway

Im currently using it on my 6p, it just lets busybox take care of mount points and appears to work fine for my device.

This also works on preview 4.

I should be able to make a fix that doesn't require busy box, the main problem is that the mount list has problems, but it's not needed on n

Fix still works on preview 5.

Here is an alternative work-around:
http://forum.xda-developers.com/nexus-6/help/adaway-android-n-t3342232/page2

Works for me on preview 5 Nexus 6P

I would much rather they fixed adaway, since you shouldnt need to flash zips to enable/disable

Still works with NRD90M

I can confirm that this doesn't work for me on Nougat either.

Update: See https://github.com/AdAway/AdAway/issues/770#issuecomment-242997754 for a better solution.


Just do this for now. Works on the final build:

mount -orw,remount /system
rm /system/etc/hosts
ln -s /data/data/hosts /system/etc/hosts
mount -oro,remount /system

Then hit the button in AdAway again. No need to flash stuff from the recovery or bootloader

Thank you, maybe this will be helpful to someone else, as I flashed a zip from the above link yesterday.

I just upgraded my wife's Nexus 5x to Android 7 (stock rooted) and repeated the TWRP flashing of the AdAway_systemless_hosts2.zip file. I have the hosts file path set to custom - /su/etc/hosts which worked in Android 6. On Android 7 Adaway is reporting that it can't create the symlink (to /data/data/hosts which is not what I've specified) and giving the dialog about S_ON and HTC which I think don't apply to the unlocked Nexus devices.

Despite this, cat /system/etc/hosts and cat /su/etc/hosts both show all the content added by AdAway so I think its just the detection that's broken.

I tried the shell commands a few posts up, but rm /system/etc/hosts gives device or resource busy.

Anyway - here's some screen shots and a bug report file in case any of that is helpful.

bugreport-NRD90M-2016-08-28-14-29-07.zip

screenshot_20160828-142516
screenshot_20160828-142540
screenshot_20160828-142550
screenshot_20160828-142607

On the Nexus 9 I symlinked to /su/etc/hosts using an edited version of the commands above and it worked great, no errors at all.
Just keep the hosts target set to default (/system/etc/hosts), and I ran this in Terminal Emulator:

su -
mount -orw,remount /system
rm /system/etc/hosts
ln -s /su/etc/hosts /system/etc/hosts
mount -oro,remount /system

Can someone compile an apk of sanjay's version? On my phone and can't compile for a week or so.

I dont have Android Studio installed at the moment. Ill try building it when i get home. I've just been using the same install and its worked through all the updates so far.

jsilvermist's method worked for me on a Nexus 5x, but I had no /su/etc/hosts beforehand, so just moved the /system/etc/hosts file there first, then linked.

I forked @sanjay900's repo, merged the latest master branch of AdAway and built the apk (debug). It works for me in a Nexus 5X and a Nexus 5 (NRD90S) with phh's superuser & busybox.

source: https://github.com/KreAch3R/AdAway

You should try a pull request to AdAway @sanjay900 :)

Here is the apk (zipped just to avoid Github file name restrictions)
AdAway-v3.1.2-sanjay900-debug.zip

I hope there's no problem providing the apk. Test it and let me know.

The main reason i didnt want to pull request, is because i deleted a lot of
code that could have created issues with previous android versions.
However, im not 100% sure if this is the case or not, but i don't think a
pull request is a good option if it does break old android versions.

On Fri, Sep 23, 2016 at 5:33 AM, George G. [email protected] wrote:

I forked @sanjay900 https://github.com/sanjay900's repo, merged the
latest master branch of AdAway and built the apk (debug). It works for me
in a Nexus 5X and a Nexus 5 (NRD90S) with phh's superuser
https://play.google.com/store/apps/details?id=me.phh.superuser&hl=en &
busybox
https://play.google.com/store/apps/details?id=com.jrummy.busybox.installer&hl=en
.

source: https://github.com/KreAch3R/AdAway

You should try a pull request to AdAway @sanjay900
https://github.com/sanjay900 :)

Here is the apk (zipped just to avoid Github file name restrictions)
AdAway-v3.1.2-sanjay900-debug.zip
https://github.com/AdAway/AdAway/files/487959/AdAway-v3.1.2-sanjay900-debug.zip

I hope there's no problem providing the apk. Test it and let me know.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/AdAway/AdAway/issues/770#issuecomment-248972477, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABxsQP-Soy3PLRMH29ukdqXYvinIPhXnks5qsrvTgaJpZM4I0sb2
.

@KreAch3R That worked for me on Nougat Nexus 6p. Thanks!

@sanjay900 I see. Well after talking about it with other developers, it's the mount command that changed in Nougat (it now defaults to toybox instead of toolbox/busybox) and its argument structure changed. That's why AdAway doesn't work in nougat, and when you hardcode the busybox line like you did, it starts working again (the whole problem is the rw mount).

So I really think the @AdAway devs should take a look at it and update it.

@gts24 Yes, it should :) Glad I helped.

Yeah, i know, that's how i knew what to change haha, But i was looking it up, do you need the other arguments for previous versions of android?
If so, it might be worth putting together a version that detects and drops the offending lines.

@sanjay900 worked great on my Nexus 5x !!
Great work ~~!!!

@KreAch3R
Shouldn't have to rely on busybox being installed though. Let alone hardcode it, hardcoding these things is what caused all this trouble to begin with. Implementing some simple checks should be enough.

That's the thing, I made this as a quick fix for my phone. That's why I
never made it a pr since it needs some checks

On 16/10/2016 5:04 AM, "Joost Bremmer" [email protected] wrote:

@KreAch3R https://github.com/KreAch3R
Shouldn't have to rely on busybox being installed though. Let alone
hardcode it, hardcoding these things is what caused all this trouble to
begin with. Implementing some simple checks should be enough.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/AdAway/AdAway/issues/770#issuecomment-253993275, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABxsQIZxOMQzRPYCM_aUwB4T8YYNW_Evks5q0PmcgaJpZM4I0sb2
.

This method by @jsilvermist just worked for me on 5X. Thanks!

@KreAch3R @sanjay900 Thanks a heap. I can confirm that the apk works on nexus 10 Manta tablet.

Cheers!

I have a version now that works fine using both Toolbox (tested on lolipop) and Toybox (tested on nougat). It no longer requires busybox, and as a result, i will submit a pull request and hopefully this will no longer be a problem.

AdAway-debug.apk.gz
https://github.com/sanjay900/adaway
Github wouldn't let me upload zips for some reason.

Someone mind testing the above apk with phh's SuperUser?

AdAway-debug.apk.gz
This version has the libraries bundled in so that the bundled webserver and dns monitor will work.

@sanjay900 Hey, great work! I browsed through the commits but I have no time to check the code changes. Do you want me to confirm anything? I'm downloading this last version now.

Just confirm for me that everything works as it should

And its all been merged in now.

Works on my aicp 12.1 h815. Thanks.

Should probably close this issue now since all these changes have been merged in and are in the preview build with a bunch of other fixes

The fdroid version is still causing trouble. Has it been updated there too? I am downloading sanjay900's version for now

Because its currently a preview build, you will need to get it from http://forum.xda-developers.com/showthread.php?t=2190753

Thank you sanjay900 i had some trouble with official CM14 on my Redmi Note 3 Pro

The debug version worked for me :)

Confirming that solution provided by @KreAch3R works fine on Android 7.1 on Galaxy Tab Pro 8.1 SM-320.

Was this page helpful?
0 / 5 - 0 ratings