Ad blocking in SailfishOS in 2023 - What are the options?

Hello,
my most promising solution for ad block is the modification of the hosts file. AdBlocking on Sailfish OS via /etc/hosts | dt.iki.fi developed a suitable solution. However for me it was still very complicated to process all the steps. Therefore I wrote a bash script that includes all steps.

just download and run the following script with root permission and after reboot ad block should work out of the box: adblock-script/adblock-script.sh at main · teertinker/adblock-script · GitHub

I hope this helps some users.

2 Likes

This usually works for me.
Type in terminal as root -

curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -o /etc/hosts

Naturally, you should be able to link it to any other hosts file of your choice.

After you do that, reboot the device, and that’s it.

5 Likes

Just to clarify:

There’s nothing wrong with using a single hosts file, but I wanted to go the extra mile, as discussed in this thread.

Therefore the script has grown quite complex:

  • it converts uBO’s uAssets as far as possible to be used by /etc/hosts
  • it downloads everything from firebog.net’s meta list plus Steven Black’s largest hosts file
  • it combines and unique-sorts everything, adds a header and finally overwrites the old /etc/hosts

My tutorial mostly describes how to make updates automatic; the script itself can be treated as opaque.

Thanks to @FelixWilke for automating that in turn, and directly linking to my script. If you want you can use this link instead and I’ll try my best to make sure not to break compatibility in future updates.

4 Likes

That sounds pretty cool. Thanks for making it.

1 Like