I’ve been adding some entries to ad-blocking in the /etc/hosts file (Sailfish 4.0.1.48) and this seems to have no effect at all (even after reboot). I have tried the same in the hosts.editable file with the same result. I thought maybe the thousands of entries (about 85000) I am adding hit a limit somewhere, so I tried adding a single line to the hosts file to check if that was respected, it was not either.
It is unclear to me whether I should be using the hosts or hosts.editable file for this. Also, is there any way to rebuild a DNS cache on Sailfish? I have tried restarting the Network from “Utilities” in the Sailfish settings with no effect.
Any hints would be much appreciated, thanks.
I am using these 4 default hosts lists that AdAway uses and am removing everything but the actual ad redirects to 127.0.0.1 or 0.0.0.0 so as not to disturb the two default entries in the Sailfish default hosts file. I am aware there are apps like Defender out there, but I would like to control my own hosts file with my shellscript and found Defender hangs while trying to download new hosts files (Defender is uninstalled). My hosts file looks like this, with of course thousands of more ad-blocking entries:
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
# AdAway hosts
127.0.0.1 analytics.163.com
EDIT: Using the same hosts file in aliendalvik by having the entry:
lxc.mount.entry = /etc/hosts system/etc/hosts none bind,create=file 0 0
in /var/lib/lxc/aliendalvik/extra_config refer to the sailfish /etc/hosts file blocks ads as expected in Android apps just fine. So it really seems Sailfish has a DNS cache of its own somewhere I need to rebuild.