Block ads on Sailfish 4.4

Yes, of course, you must follow next steps to INSTALL hosty:

  1. Enable “Developer Mode” from Settings. Terminal will be installed in your phone
  2. Open Terminal and run next commands.
    devel-su pkcon install p7zip-full gawk gzip nano
    devel-su pkcon install gnu-bash #NOTE:This action will remove busybox-symlinks-bash package under your responsibility
    devel-su ln -s /usr/bin/gpg2 /usr/bin/gpg
  3. Install cronie or vixie-cron from
  4. Install sudo from Terminal:
    devel-su pkcon install sudo
  5. Edit “sudoers” using “nano” and add “defaultuser” to properly use of hosty:
    devel-su nano /etc/sudoers
    Adding at the end of the file:
    defaultuser ALL=(ALL) ALL
  6. Just run:
    curl -L | sh
  7. During installation hosty will ask if you want to automatically run hosty from time to time to update your hosts file with the latest list of domains.
    We answer the following questions:
    Do you want to always run the latest version of hosty? Y
    Do you want to automatically update your hosts file with latest ads list? n
  8. Once hosty ends its installation, just run again:
    curl -L | sh

To RUN hosty, just run sudo hosty from Terminal. You probably want to run it periodically to update your hosts file with latest domains list or you can use sailcron for that.

NOTE: I use hosty since sfos 4.2, but I remember that I had to install and unistall defender II to get working properly. I’m on sfos 4.4


That’s amazing! Thank you so much! I’ll try to do it ASAP.

Edit: it’s working like a charm after I removed the hosts-AdBlock app and rebooted the device

Did you install/uninstall defenderII?

1 Like

I removed it and it’s working as advertised. Amazing! Thank you so much!

1 Like

I’ll be the “party pooper” and say that the above method described by carmen -while it works- isn’t the most user friendly way of doing something. :confused:

We need ublock.

1 Like

Not only that. So much heated security and privacy discussions e.g. like in the other thread about SFOS 4.4 and AML and then we let the unsecure practice of the “curl <random_url> | sh” still live.


Hi. Thanks for this detailled info…
Does it require anything special with the OS Updates ??

What about an inbuild Solution for the SailfishOS-Browser?

The Browser using the ESR78-Firefox-Engine, so there is no way to add Plugins like Adblock?

1 Like

I found out why Defender doesn’t work anymore. First, database where cookies are stored is now locked when the browser is running. You must close the browser for Defender to work.

Second issue, database’s schema has changed. And a column doesn’t exist anymore. I already found a solution, but I need more time to provide a PR.

If someone with python knowledge has time: here is the repository :

1 Like

No, it works for me since sfos 4.2, and never stopped working in every update

You might want to contact the maintainer (@peterleinchen) of the project about this issue.

If I understand well how defender works, it downloads hosts files from the selected ones, and then process all entries and add them to SFOS host file.
On first update it’s quite fast, but on subsequent updates, it takes a very, very long time because, it seems, it checks if the entry already exists.

Wouldn’t be a good idea to write a new system adbocker, maybe in C++ or QML, with a faster efficient update mechanism ? I can try and help, though the first step is to properly define the need block ads, updates, etc.) and architecture of the software.

1 Like

Hosty looks promising, I like the idea that the functionality is provided by a shell script, rather than a full-featured app.
But it seems I’m doing something wrong. When running hosty, I get multiple warnings originating from gawk, complaining about the -i inplace extension used in the extractDomains() funktion. It seems the gawk version installed cannot handle -i inplace? Gawk version is GNU Awk 3.1.5.
However, a modified hosts file is generated and installed.

Currently I’m using privoxy for adblocking, only the adblock2privoxy script was not as easy to setup.

Please just hint at the solution and I’ll go look at making a PR …

1 Like

They are in the issues :wink:

Ah, sorry, to many projects, too repos, too many tickets :slight_smile:

1 Like

Yep, I get warnings about gawk too when I run hosty

Why check? Wouldn’t it be easier to rewrite the entire file with new and updated content?

I guess it’s to prevent removing user or OS specific entries in the host file, and to avoid duplicates.

1 Like