Defender app update (harbour-defender) - my very own ‘Sailfish Devember’

There is a new version out on chum:

v0.8.12

This release has undergone lot of testing and debugging and quite some changes since last one, see the changelog yourself…

Main things are

Defender is now fully sailjailed (for SFOS >= 5)

It works on Jolla devices and XA2,

also on the 10III (no other 10 devices tested yet).

Translations done for Swedish (@eson), Spanish (@carmenfdezb), German (@peterleinchen)

New ad-blocker sources

Lot of small fixes, enhancements

3 Likes

Thanks for your contributions.

BTW: for me changelog link is 404.

1 Like

Corrected (was taken from github app but hey :face_without_mouth: , now manually linked)

1 Like

Defender seems to be broken on the new Jolla Phone 2026.

Here’s the output. Certainly willing to help debug, although I’ve seen away from Sailfish for a long time.

[D] unknown:0 - Using Wayland-EGL
library "libselinux.so" not found
Could not open module param file '/sys/module/mali_kbase/parameters/large_page_conf'
[42921.894309] (harbour-defende) [MEMPROF] Memory instrumentation via debugfs enabled
[D] unknown:0 - Got library name:  "/usr/lib64/qt5/qml/io/thp/pyotherside/libpyothersideplugin.so"
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:24: TypeError: Cannot read property 'cookies_count' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:29: TypeError: Cannot read property 'domains_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:24: TypeError: Cannot read property 'hosts_lines' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:29: TypeError: Cannot read property 'sources_enabled_count' of undefined
library "/vendor/lib64/egl/mt6858/libGLES_mali.so" needed or dlopened by "(unknown)" is not accessible for the namespace "(default)"
library "/vendor/lib64/egl/mt6858/libGLES_mali.so" ("/vendor/lib64/egl/mt6858/libGLES_mali.so") needed or dlopened by "(unknown)" is not accessible for the namespace: [name="(default)", ld_library_paths="/usr/libexec/droid-hybris/system/lib64:/system/lib64:/vendor/lib64", default_library_paths="/system/lib64:/system_ext/lib64", permitted_paths="/system/lib64/drm:/system/lib64/extractors:/system/lib64/hw:/system_ext/lib64:/usr/libexec/droid-hybris/system/lib64:/system/framework:/system/app:/system/priv-app:/system_ext/framework:/system_ext/app:/system_ext/priv-app:/vendor/framework:/vendor/app:/vendor/priv-app:/system/vendor/framework:/system/vendor/app:/system/vendor/priv-app:/odm/framework:/odm/app:/odm/priv-app:/oem/app:/product/framework:/product/app:/product/priv-app:/data:/mnt/expand:/apex/com.android.runtime/lib64/bionic:/system/lib64/bootstrap"]
library "/vendor/lib64/hw/mt6858/mapper.mediatek.so" needed or dlopened by "(unknown)" is not accessible for the namespace "(default)"
library "/vendor/lib64/hw/mt6858/mapper.mediatek.so" ("/vendor/lib64/hw/mt6858/mapper.mediatek.so") needed or dlopened by "(unknown)" is not accessible for the namespace: [name="(default)", ld_library_paths="/usr/libexec/droid-hybris/system/lib64:/system/lib64:/vendor/lib64", default_library_paths="/system/lib64:/system_ext/lib64", permitted_paths="/system/lib64/drm:/system/lib64/extractors:/system/lib64/hw:/system_ext/lib64:/usr/libexec/droid-hybris/system/lib64:/system/framework:/system/app:/system/priv-app:/system_ext/framework:/system_ext/app:/system_ext/priv-app:/vendor/framework:/vendor/app:/vendor/priv-app:/system/vendor/framework:/system/vendor/app:/system/vendor/priv-app:/odm/framework:/odm/app:/odm/priv-app:/oem/app:/product/framework:/product/app:/product/priv-app:/data:/mnt/expand:/apex/com.android.runtime/lib64/bionic:/system/lib64/bootstrap"]
[W] unknown:22 - file:///usr/share/harbour-defender/qml/cover/CoverPage.qml:22: TypeError: Cannot read property 'last_sources' of undefined
[D] unknown:0 - "PyOtherSide error: Traceback (most recent call last):\n\n  File \"/usr/share/harbour-defender/qml/python/defender.py\", line 312, in get_stats\n    data = json.load(data_file)\n           ^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/__init__.py\", line 293, in load\n    return loads(fp.read(),\n           ^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/__init__.py\", line 346, in loads\n    return _default_decoder.decode(s)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/decoder.py\", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/decoder.py\", line 355, in raw_decode\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\n\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n"
[W] unknown:0 - Unhandled PyOtherSide error: Return value of PyObject call is NULL: Traceback (most recent call last):

  File "/usr/share/harbour-defender/qml/python/defender.py", line 312, in get_stats
    data = json.load(data_file)
           ^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

[D] unknown:0 - "PyOtherSide error: Traceback (most recent call last):\n\n  File \"/usr/share/harbour-defender/qml/python/defender.py\", line 312, in get_stats\n    data = json.load(data_file)\n           ^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/__init__.py\", line 293, in load\n    return loads(fp.read(),\n           ^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/__init__.py\", line 346, in loads\n    return _default_decoder.decode(s)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/decoder.py\", line 337, in decode\n    obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/usr/lib64/python3.11/json/decoder.py\", line 355, in raw_decode\n    raise JSONDecodeError(\"Expecting value\", s, err.value) from None\n\njson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)\n"
[W] unknown:0 - Unhandled PyOtherSide error: Return value of PyObject call is NULL: Traceback (most recent call last):

  File "/usr/share/harbour-defender/qml/python/defender.py", line 312, in get_stats
    data = json.load(data_file)
           ^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib64/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:29: TypeError: Cannot read property 'sources_enabled_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:24: TypeError: Cannot read property 'hosts_lines' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:29: TypeError: Cannot read property 'domains_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:24: TypeError: Cannot read property 'cookies_count' of undefined
[W] unknown:22 - file:///usr/share/harbour-defender/qml/cover/CoverPage.qml:22: TypeError: Cannot read property 'last_sources' of undefined
[D] :52 - Working directory: /home/defaultuser
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:29: TypeError: Cannot read property 'sources_enabled_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:24: TypeError: Cannot read property 'hosts_lines' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:29: TypeError: Cannot read property 'domains_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:24: TypeError: Cannot read property 'cookies_count' of undefined
[W] unknown:22 - file:///usr/share/harbour-defender/qml/cover/CoverPage.qml:22: TypeError: Cannot read property 'last_sources' of undefined
1 Like

:frowning:h, wow! :disappointed_face:

Looks like a lot of work after receiving my new Beauty.

But before we deep dive.

The bickering about cannnot read undefined items is negligible.

But heavily wondering about libselinux.so cannot be found!!!

This is under /usr/lib/ and definitely whitelisted.

So, which version are you testing?

I do hope latest from Chum (0.8.xx)? (Even that may not be compiled for 5.2, but would not explain above)

You may try to test the one from chum:testing, this is newer version with noarch and some more changes (v0.9.2 or v0.9.3?)

I was running the latest version from Chum, yes, and updating to the testing version doesn’t fix things.

However, I think things are probably not nearly as broken as my post made it seem. Here’s where my lack of Sailfish knowledge shows through. In order to produce the log output, I was running harbour-defender directly from the shell, not via sailjail, without realising that this was going to change the behaviour significantly.

Running via sailjail (I still don’t know what I’m doing, so I just stole the commandline by catching it as the UI was attempting to run Defender), gives the much less concerning following output:

Reading profile /etc/sailjail/permissions/harbour-defender.profile
Reading profile /etc/sailjail/permissions/Compatibility.permission
Reading profile /etc/sailjail/permissions/Connman.permission
Reading profile /etc/sailjail/permissions/Internet.permission
Reading profile /etc/sailjail/permissions/Connman.permission
Reading profile /etc/sailjail/permissions/PublicDir.permission
Reading profile /etc/sailjail/permissions/Internet.permission
Reading profile /etc/sailjail/permissions/Connman.permission
Reading profile /etc/sailjail/permissions/PublicDir.permission
Reading profile /etc/sailjail/permissions/Base.permission
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-common.local
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/sailjail/permissions/Notifications.permission
Reading profile /etc/sailjail/permissions/Sharing.permission
firejail version 0.9.79

Parent pid 26009, child pid 26016
constructing /run/firejail/mnt/privileged:  ...
mounting /run/firejail/mnt/privileged @ /home/defaultuser/.local/share/system/privileged
hiding /run/firejail/mnt/privileged
Warning: /usr/bin/bwrap was not disabled
Warning: invalid private-bin path /usr/bin/bwrap
28 programs installed in 151.71 ms
Warning: An abstract unix socket for session D-BUS might still be available. Use --net or remove unix from --protocol set.
Warning: you are not allowed to change /etc/defender.conf to read-write
Warning: you are not allowed to change /etc/hosts.editable to read-write
Warning: you are not allowed to change /etc/hosts.editable to read-write
Base filesystem installed in 233.61 ms
Child process initialized in 1239.59 ms
[D] unknown:0 - Using Wayland-EGL
Could not open module param file '/sys/module/mali_kbase/parameters/large_page_conf'
[16521.103149] (sailfish-qml) [MEMPROF] Memory instrumentation via debugfs enabled
[D] unknown:0 - Got library name:  "/usr/lib64/qt5/qml/io/thp/pyotherside/libpyothersideplugin.so"
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:24: TypeError: Cannot read property 'cookies_count' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:29: TypeError: Cannot read property 'domains_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:24: TypeError: Cannot read property 'hosts_lines' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:29: TypeError: Cannot read property 'sources_enabled_count' of undefined
library "mapper.mediatek.so" not found
gralloc-mapper is missing

Parent is shutting down, bye...

So if I’m guessing, the only actual problem there might be the lack of “mapper.mediatek.so”. My apologies for causing undue alarm!

Yes, you might be right.

I was struggling with Xperia10 devices a lot until we found the real cause.

And hoped with the new Jolla (mediatek) this would not be necessary.

Could you open the console and try

find / -name mapper.mediatek.so

I could narrow it down to guessed places but if you do not have thousands of pics/vids/music on it….

Just let it run, will take some time.

I’ll do ya one better…

[root@JollaPhone2026 defaultuser]# find / -name mapper.mediatek.so -exec ls -l {} \; 2>/dev/null
lrwxrwxrwx    1 root     root            25 Jul  7 09:57 /vendor/lib64/hw/mapper.mediatek.so -> mt6858/mapper.mediatek.so
-rw-r--r--    1 root     root        220208 Jul  7 09:57 /vendor/lib64/hw/mt6858/mapper.mediatek.so
2 Likes

Great! :slight_smile:

Would you like it the old long hard way?

a) so lib by lib? For the 10 III we fought quite a while as I did not have that device in my hands (at that time :wink:).

Or

b) I can just add all lib dirs of the 10III to the whiltelist of JP2602. But this could lead to loading times of over 30 seconds :frowning: .

I opt for a)

And will send you a file harbour-defender.profile to drop to the /etc/sailjail/permissions/ dir

Or you might just edit it and add that above found dir to it (quite at the very end)

whitelist /vendor/lib/hw/mt6858/*
whitelist /vendor/lib64/hw/mt6858/*

Let me know which way…

Adding the whitelists fixes the wrapper error. Now exiting with:

[D] unknown:0 - Using Wayland-EGL
couldn't find an OpenGL ES implementation, make sure one of persist.graphics.egl, ro.hardware.egl and ro.board.platform is set

Parent is shutting down, bye...

I don’t know how much you want to handhold here, given that I don’t really what I’m doing. (Fairly extensive Linux experience, quite limited Sailfish.) But I’m willing to keep poking as long as you want me to. :slight_smile:

1 Like

Hmm, I might as long as it needs… :wink:

But I sent you a file via PM. Just extract it and add (cat >>) it to the harbour-defender.profile.

if that does not work it will be ping pong again…..

But be patient, might take some time to load and start!

I’ve been playing around with this a bit, and not really made much progress. I’ve done a couple of different things that cause a couple of different failure modes.

First one, already addressed above, is if I whitelist /vendor/lib/hw/mt6858/*, Defender exits with the following error:

[D] unknown:0 - Using Wayland-EGL
couldn't find an OpenGL ES implementation, make sure one of persist.graphics.egl, ro.hardware.egl and ro.board.platform is set

The only previous reference to this error in the forum seems unrelated enough not to be useful here, although I did play around with setting QT_QPA_PLATFORM=hwcomposer, which gave me:

library "libged_kpi.so" not found
Can't create AidlComposerClient, fallback to HIDL

I imagine this was a dead end, and probably unrelated to the solution to this issue.

Second one, which is pretty curious to me, is when I was just poking around kind of randomly at this, if instead of whitelisting /vendor/lib/hw/mt6858/*, I just copy /vendor/lib64/hw/mt6858/mapper.mediatek.so to /vendor/lib64, I end up with this very different error message:

[W] unknown:0 - QObject::moveToThread: Current thread (0x5dadc180c0) is not the object's thread (0x5dad1c7800).
Cannot move to target thread (0x5dad6e9eb0)

[W] unknown:0 - QObject::moveToThread: Current thread (0x5dadc180c0) is not the object's thread (0x5dad1c7800).
Cannot move to target thread (0x5dad6e9eb0)

[F] unknown:0 - Cannot make QOpenGLContext current in a different thread

I have no idea why forcing it to load the mediatek library from a different location would cause such a different output, but maybe this means something to someone. :slight_smile:

I am presently using the most recent version of Defender from Chum testing (0.9.3), but I get all the same behaviour from the release version.

1 Like

After a DM from @peterleinchen got me poking around with the whitelists, I found that Defender did work properly with a wide net whitelist, and then I narrowed it down to a logical minimal set. The following additions to /etc/sailjail/permissions/harbour-defender.profile successfully get Defender working on the new Jolla phone:

whitelist /etc/ld.so.preload
read-only /etc/ld.so.preload

whitelist /system/bin/zcat
read-only /system/bin/zcat
 
whitelist /vendor/lib64
read-only /vendor/lib64

:tada:

1 Like

And v0.9.4 is out.

Biggest changes:

  • Now real pure qml app, no binary built, noarch
  • Lots of small changes regarding directories used, whiyelisting, etc
  • Introduced X-HarbourBackup for easy backup of configurations
  • Added configuration for update schedule
  • Adapted DNS flushing to 5.1
  • Aaand: Sailjail profile compatibility for new Jolla Phone jp2601 by the tremendous help of @aos
7 Likes