Reading a post by @GreatJoe 's experience as a new SFOS user highlighted that there currently seems to be no easy solution for ad blocking in SFOS for regular users. From what I could crowd-source and found on this forum, these are our options:
Hosts Adblock
Working Status: Seems broken from SFOS 4.4
Covers: SFOS and Android App Support
Pros: Set and forget, very simple program/script
Cons: No AARCH64 version, Possible Sailjail issues, Unmaintained/Abandoned
Defender II
Working Status: Unknown/Unclear
Covers: SFOS and Android App Support
Pros: Set and forget, GUI based, user-friendly
Cons: Have boot-looped devices in the past etc.
AdBlocking on Sailfish OS via /etc/hosts
Working Status: Working
Covers: SFOS and Android App Support
Pros: No extra dependancies to be installed, simple solution (Unlikely to cause issues with SFOS updates?)
Cons: Not exactly user-friendly to regular users
Just curl a blocklist to hosts file
Working Status: Working
Covers: SFOS only (But can be both with symlinc)
Pros: No extra dependancies to be installed, simple solution (Unlikely to cause issues with SFOS updates?)
Cons: Not exactly user-friendly to regular users
Privoxy
Working Status: Working
Covers: SFOS and Android App Support
Pros: Extremely powerful solution
Cons: Setup and config is difficult (Or maybe notā¦)(Not for regular user), possibly touching many SFOS system files and configs (Might cause issues with SFOS updates?)
DNScrypt-proxy blocklist (DNS alternative)
Working Status: Working
Covers: SFOS and Android App Support
Pros: Much more control and many additional features
Cons: Not exactly user-friendly to regular users, possibly touching many SFOS system files and configs (Might cause issues with SFOS updates?)
Android Firefox-based browser with uBlock Origin
Working Status: Working
Covers: Browser only
Pros: User-friendly
Cons: Only works in the browser itās installed in (Not system wide)
Disclaimer: The list above is entirely based on my own opinion and research and may, and probably do, contain errors. There might be other possible solutions I have not found and thus they do not appear in the list above. Hosts-based solutions seem to require a reboot of the phone before the updated hosts-file is used and no solution to this has been proposed.
So here is the question: What solution has the lowest risk and easiest set up? What solution do you use or would recommend?
P.S. I have used solution 1 for nine years on a Jolla 1 without issues. For newer devices, Iām not sureā¦
EDIT: I do not endorse any specific solution, nor have I tested all of these, YMMV
Testing Privoxy on Vollaā¦
Installed everything from Chum (Privoxy, AdBlock configuration, Docs, http server and tools) and rebooted. It installed 2 new icons on app grid, and Privoxy Config did nothing and Privoxy Toggle showed something about a proxy 127.0.0.1 port 8118 not installed or so.
After I entered this proxy into Settings/System/Mobile Network/Advanced/Proxy 1, the 2 new icons on app grid show:
Privoxy Config: Privoxy Menu (6 items) + Support and Service.
Privoxy Toggle: Privoxy is enabled
My observation: clean sites load much faster but āless cleanā ones showing no images now. So for me this means that Privoxy worksā¦
working and faster: Youtube, orf.at, de.m.wikipedia.org, hpmuseum.org, hpcalc.org
Not working: la-palma24.info - reports: Unable to connect, Browser canāt establish connection to googleads.g.doubleclick.net, that means that it works as it should.
edit: images come after two minutes.
Have to say, itās not sooo difficult.
Iām curious and will report if some annoying effects will occur.
edit: installation also successful on Xperia 10. Thanks again!
edit: Blocking does also work if phone is used as mobile access point. Annoying advertisement also filtered on laptop connected to Hotspot. Pages load noteable faster but sometimes also content is missing.
Option 5.
The browser is basically the only thing that has ads in sfos so thereās no need for anything else for me.
Android browsers already have Adblock or can be installed as a plugin.
For YouTube I use microtube that doesnāt show ads and also has sponsorblock.
With āSetup and config is difficultā I meant the instructions seemed a bit convoluted or unclear (Which I think your reply proves ). Also, if this breaks something somewhere in SFOS, a regular user might not easily be able to fix their systemā¦
Other than that, I assume ReVanced manager should work here too. Itās a tool to apply different types of patches in apps like YouTube, Twitch, Spotify and some social.
You are invited to make a pull request with changes to the README, or cook up your own guide which I can link to,or any other suggestions you have, in order to make this better.
Just to manage expectations though: privoxy can not and will not ever be a one-klick-it-works kind of app. By nature of the software you have to have some knowledge how it works, how websites etc work.
Knowing what youāre doing also reduces the chances of something breaking. (In fact the reason Iām giving hands-on instructions in text form instead of doing this somehow automatically is done intentionally to lower the risk of breakage.)
Also, please understand that my goal or role in all of this is not to provide a āprivacy appā or āadblocking solutionā.
My role is packagingthe upstream software so it runs on SFOS, with minimal modifications. And I add some SFOS-specific add-ons that I think are useful (like the preconfigured ab2p infrastructure and config, some housekeeping stuff, etc.). This is what I can do, this is what I can support, not more.
This is not elitism I believe, as @GreatJoe suggests, it is due to the fact that Privoxy is supposed to be run on a server-type machine, which a admin-type person who configures it for their users.
Coaxing it onto a phone and make it block stuff is possible thanks to the wonderfulness of Linux, but setting it up it does involve the same admin-type tasks.
Anyway, apart from installation and initial setup, if anyone has something running in Privoxy they are very much invited to share their config hacks and snippets in this thread or through the source repo and hopefully the rules shipped with it can be improved for everybody.
I meant no offense, nor did I mean to imply anything more than that this solution is not meant for a āregularā user (The adage ānever run commands you donāt understandā comes to mind). I do not agree with @GreatJoe calling this elitism, and I agree with your statement āKnowing what youāre doing also reduces the chances of something breaking.ā I would add to that āKnowing what youāre doing also enables you to fix something if it breaks.ā
As Iām using SailfishOS daily now I immediately encountered this problem and Iāve solved it by using Blocky (itās like Pi-Hole or AdGuard).
Iāve now released a UI for it. I had bigger plans for my first release (like YAML validation or hosts lists reload, etcā¦), but I want to share it anyway at this stage as this thread is a bell that other people may need it.
Working Status: Alpha release. Disables connman DNS functionality and enable blocky. Itās possible to edit the configuration from the UI, but if you make any error you are screwed (delete ~/.config/dev.scarpino/harbour-blocky/blocky.yaml to start with the default config).
Covers: SFOS and Android App Support (? I guess, I donāt use it)
Pros: Set and forget.
Cons: No i486 version (missing upstream), runs as root (needed to restart blocky).
This is probably the simplest solution especially used in combination with dnsmasq or DNS Alternative. There is also another provider that offer a similar service: Quad9 therefore the best combination is to alternate the two services in the DNS queries, like in the following:
This is an example of /etc/resolv.conf for every host connected with an IPv4 + IPv6 network which alternates AdGuard and Quad9 ad-blocking and safe-filtered DNS .
During the next steps, however, I got lost.
Putting the following in the terminal: ~/.local/bin/hosts
results in an error (no such file/directory exists)
I had to create the file first.
the same goes with hosts.head (I needed to create the file first, and have to chance the permissions second)
I have changed the article so that the script resides in /usr/local/bin/hostsupdate instead of the userās home directory, and gave it a better name. It makes more sense this way.
the necessity of hosts.head being present beforehand (and created manually) is mentioned in the article. I cannot automate ths process without complicated checks and taking the userās freedom to have a customised hosts file (i.e. the head portion of it) but I added a check to the script that will make it fail if that file is not present.
Yes some preliminaries are required but tbf, it is possible to do everything on the device, without ssh.
I just used your script/timer approach and went with the ad block test site Test Ad Block - Toolz from 9% to 54% of blocked ads with the sailfish browser - pretty nice.