FORUMS
Remove All Ads from XDA

[MOD][GUIDE] AdAway on Write Protected /system Partitions [RECOVERY]

74 posts
Thanks Meter: 223
 
By Mantelinho, Member on 17th June 2013, 05:36 PM
Post Reply Email Thread
If your /system partition is write protected like on the HTC One (M7) and you try to use an advertisement blocker like AdAway, you will encounter that changes to /system/etc/hosts are lost after reboot and ad blocking doesn't work. You have basically 3 methods to get around this:

A) Link /system/etc/hosts to a partition AdAway can write to
Install symlink_hosts_to_data.zip via your custom recovery (like CWM) to create a symbolic link from /system/etc/hosts to /data/data/hosts. Afterwards you can configure AdAway to use /data/data/hosts (as shown in attached screenshot) and it will work perfectly with updates and everything.

B) Flash the hosts file directly
Install adaway_hosts_2014-04-14.zip via recovery. Now you have the hosts file as AdAway created on April 14th 2014. Disadvantage: you would need to flash again for updates. Advantage: you don't need the AdAway app at all. Note: many custom ROMs include such a hosts file already in their distribution.

C) Make /system partition writable
Use this kernel extension or a custom ROM including it to have the /system partition writable all the time. AdAway will work out-of-the-box then.

If you like to restore original state after having flashed one of the recovery zips above, use the attached restore_original_hosts.zip
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2013-06-20-11-09-13.jpg
Views:	10619
Size:	25.4 KB
ID:	2056549  
Attached Files
File Type: zip restore_original_hosts.zip - [Click for QR Code] (139.0 KB, 3956 views)
File Type: zip adaway_hosts_2015-04-13.zip - [Click for QR Code] (426.2 KB, 4452 views)
File Type: zip symlink_hosts_to_data.zip - [Click for QR Code] (138.5 KB, 8810 views)
The Following 53 Users Say Thank You to Mantelinho For This Useful Post: [ View ] Gift Mantelinho Ad-Free
 
 
17th June 2013, 06:04 PM |#2  
melando's Avatar
Senior Member
Flag London
Thanks Meter: 216
 
More
Quote:
Originally Posted by Mantelinho

The attached recovery flashable update.zip modifies your /system/etc/hosts file just like AdAway or Adblock Plus would. Useful if your /system partition is write protected like on the HTC One (and changes are lost after reboot).

You need

  • a custom recovery like ClockWorkMod on your device
  • the understanding that you will use this script at your own risk
You could also
  • make the /system partition writable via kernel patch and use the app
  • use a custom ROM which comes with an ad-blocking hosts file already
This uses the hosts list from AdAway as of June 17th 2013. All credits for this to AdAway and its contributors

Can you create a script which creates the symbolic link i.e. the approach recommended in AdAway help (S-ON/S-OFF)? That would allow the file to be updated by the app over time...
The Following 3 Users Say Thank You to melando For This Useful Post: [ View ] Gift melando Ad-Free
17th June 2013, 06:17 PM |#3  
Mantelinho's Avatar
OP Member
Flag Düsseldorf
Thanks Meter: 223
 
More
Quote:
Originally Posted by melando

Can you create a script which creates the symbolic link i.e. the approach recommended in AdAway help (S-ON/S-OFF)? That would allow the file to be updated by the app over time...

This makes sense if you want to keep using the app, thanks for the hint. I uploaded symlink_hosts_to_data.zip and updated the opening post. This will work also after having the other zip already applied.
The Following 3 Users Say Thank You to Mantelinho For This Useful Post: [ View ] Gift Mantelinho Ad-Free
17th June 2013, 07:28 PM |#4  
jonny68's Avatar
Senior Member
Flag Dublin
Thanks Meter: 620
 
More
Cheers, do I need all 3 zips or just the one dated today?

Sent from my Nexus 7 using xda app-developers app
17th June 2013, 07:34 PM |#5  
Mantelinho's Avatar
OP Member
Flag Düsseldorf
Thanks Meter: 223
 
More
Quote:
Originally Posted by jonny68

Cheers, do I need all 3 zips or just the one dated today?

Either the one dated (and you're fine) OR the symlink one if wanting to use AdAway configured to write to /data/data/hosts. The third file is only for restoring original state.
The Following User Says Thank You to Mantelinho For This Useful Post: [ View ] Gift Mantelinho Ad-Free
17th June 2013, 08:34 PM |#6  
jonny68's Avatar
Senior Member
Flag Dublin
Thanks Meter: 620
 
More
Cheers, so should this block all ads then, I had the ad block apk. But it didn't block all annoying ads?

Sent from my Nexus 7 using xda app-developers app
17th June 2013, 08:53 PM |#7  
Mantelinho's Avatar
OP Member
Flag Düsseldorf
Thanks Meter: 223
 
More
Quote:
Originally Posted by jonny68

Cheers, so should this block all ads then, I had the ad block apk. But it didn't block all annoying ads?

This should block all ads so far (at least it absolutely does for me). However the list of ad servers is actively maintained by hosts-file.net. If you should find an ad host not blocked you can post it there and it will find its way back to AdAway. To be always up-to-date I recommend using AdAway with the symlink method from OP.
The Following User Says Thank You to Mantelinho For This Useful Post: [ View ] Gift Mantelinho Ad-Free
17th June 2013, 10:34 PM |#8  
jonny68's Avatar
Senior Member
Flag Dublin
Thanks Meter: 620
 
More
Dunno why but it doesn't block ads on the goal.com app but for some reason no adblock app ever really did, strange!

Sent from my Nexus 7 using xda app-developers app
10th July 2013, 10:47 AM |#9  
B BOY DRAW2's Avatar
Member
Flag Wellington
Thanks Meter: 22
 
More
sinna ketskm
Hey, just inquiring...

I've done the "flash host files directly" step, and playing Subway Surfers.

It would seem that ads are only blocked on that game when I have system set to RW...(I think...?...not 100% sure, but it would seem this way)

I was under the impression that it shouldn't matter because I'm flashing the host file directly?

Can anyone offer their thoughts please.
10th July 2013, 02:24 PM |#10  
Mantelinho's Avatar
OP Member
Flag Düsseldorf
Thanks Meter: 223
 
More
Quote:
Originally Posted by B BOY DRAW2

Hey, just inquiring...

I've done the "flash host files directly" step, and playing Subway Surfers.

It would seem that ads are only blocked on that game when I have system set to RW...(I think...?...not 100% sure, but it would seem this way)

I was under the impression that it shouldn't matter because I'm flashing the host file directly?

Can anyone offer their thoughts please.

Yes, after flashing the hosts files directly no further steps should be necessary and ads be gone. Can you verify that ads also exist in other applications (or websites)? Maybe this is an issue with the app you are using, for example if it loads its apps from its own (unblocked) server.
The Following User Says Thank You to Mantelinho For This Useful Post: [ View ] Gift Mantelinho Ad-Free
10th July 2013, 05:00 PM |#11  
B BOY DRAW2's Avatar
Member
Flag Wellington
Thanks Meter: 22
 
More
Yeah, I think you're right about it perhaps being app related. I think maybe I need to monitor it a bit more closely and take random notes...
like sometimes I'm bombarded with advertisments any time I touch to advance or go back through menus...but just in that app...then I'll reboot...and sometimes it'll go a full day without ads...?

I also use a local news app which would normally advertise dating links, but those don't seem to appear...so it's definitely working.

All good though...thanks for answering that for me!
Much appreciated!!!
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes