Editing hosts & hosts.editable has no effect

I’ve been adding some entries to ad-blocking in the /etc/hosts file (Sailfish 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 or 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:		localhost.localdomain localhost
::1		localhost6.localdomain6 localhost6

# AdAway hosts 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.

1 Like

Please see


1 Like

Excellent, adding the nsswitch.conf did the trick. Thanks a lot! I have marked your response as the solution.

I guess this also means I will stick to modifying the traditional hosts file, as opposed to hosts.editable.

1 Like