Can not run android apps that use realm (e.g. Element) after updating to 4.5

Hi,

In case someone has issues with storage, please check if the following would help. One device got fixed with this who had issues with WhatsApp especially.

devel-su
systemctl stop aliendalvik
chown 501023:501023 /home/defaultuser/android_storage /home/defaultuser/android_storage/Android 
chown 501023:501078 /home/defaultuser/android_storage/Android/data 
chown 501023:501079 /home/defaultuser/android_storage/Android/obb
systemctl start aliendalvik

cc: @goverton who had the issue in other thread.

1 Like

unfortunatley it does look like this won’t change anything for me:. (I did not run the chown commands)

$ ls -na /home/defaultuser/android_storage/Android
total 40
drwxrws--x    5 501023   501023        4096 Feb  2 16:54 .
drwxrwx---   16 501023   501023        4096 May 25 23:33 ..
drwxrws--x   51 501023   501078        4096 May 28 17:53 data
drwxrws--x    5 501023   501023        4096 Nov  4  2022 media
drwxrws--x    8 501023   501079        4096 May 29 23:15 obb

@jovirkku Could you get any insight on what is the cause of the issue?

And /home/defaultuser/android_storage permissions are the same also?

And /home/defaultuser/android_storage permissions are the same also?

Obviously so.

This should be ..

fill characters:

the shell is like regret
once you got it, you better never stop fighting it.

(sorry for that :wink:

1 Like

Indeed Element notifications, and even with Element I would like more noticeable notifications / sound / blue led etc. Fluffychat is a decent alternative and also has the option to add multiple accounts witch Element miss this functionality. A kind of work arround to no-notification problem I do is to run a sailfish matrix client: it might not has encryption support but at least I get notified.

Notify with ntfy and fluffychat works and configuration is “magique”

Could you share the “magique” way to have notifications with fluffychat ?!

I do nothing just installed fluffychat and ntfy

Launch ntfy
Launch fluffychat
In fluffychat go to settings notification, activate if not done and a subscription is done in nfty… Tada !!!

Thank you for the instructions @kaulian, I tried it, I run ntfy, I saw there the fluffychat, I saw a link to ntfy.sh but after that no notification on the sailfish… In fluffychat notification all settings are on (no setting for ntfy.sh) . Should the notifications go through ntfy.sh ? ( I wouldn’t like the notification goes out of the phone) Do I have to enable / activate anything else to have notifications on sailfish - like receiving sms kinda?

Thank you in advance!

If you use Element version from F-droid, there is no problem with notifications because it use there own pulling system, while the play store version relies on Google push service.

Perhaps in old time i did that

Try old version with register in unifiedpush.org

To add information to this ticket, I have this problem with apps that use realm on my new 10III, but not on my XA2 plus.
The 2 phones freshly flashed with 4.5.0.19 and no problem on the XA2.
@thigg, you noted you have this also on the XA2 ?

1 Like

Here are my observations done so far:

  • Initialized Realm database on former Sailfish OS version (4.4) works fine after migration to current release (4.5)
  • Re-initialization or installation of a new Realm-based application crashes with “File not found” error

Now what’s crashing it and what file is not found?

I compiled Realm and added debug output to see where the “File not found” is located as the error message shown in logcat output is misleading in thinking a .cpp file could not be compiled JIT. It simply shows the source code line number where a std_io error (file not found) was excepted. (see realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp at main · realm/realm-java · GitHub)

This brings in the JNI runtime bindings used by Realm. If a new database is going to be initialized a shared access thread tries to read the database file located inside the appsupport container at

/data/user/0/<name of your APK package>/files/<name of the Realm database file> (this is the file not found by the initialization shared Realm thread)

This path can be found at the host filesystem here:

[root@Xperia10II-DualSIM user]# pwd
/home/.android/data/user
[root@Xperia10II-DualSIM user]# ls -la
total 20
drwx--x--x    3 501000   appsuppo      4096 Feb  2 16:05 .
drwxrwx--x   46 501000   appsuppo      4096 Jun 11 00:46 ..
drwx------    2 501000   appsuppo      4096 Feb  2 16:05 0

However the 0 directory is mounted inside the appsupport container from /data/data/ so the host folder shows an empty directory here.

# mount | grep /data
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data/media/0 type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data/user/0 type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)

That being said it looks like the initialization thread started by Realm JNI is either missing permissions to access the database file or it uses the plain (unmounted) /data/user/0 folder where no files are located.

Why I’m saying this?

Compared to a working Sailfish OS 4.4 appsupport container you’ll see that the /data/user/0 is symlinked to /data/data.

(Appsupport XA2, SFOS 4.4)

# ls /data/user -la
total 8
drwx--x--x  2 system system 4096 2019-11-29 13:56 .
drwxrwx--x 45 system system 4096 2023-06-14 08:54 ..
lrwxrwxrwx  1 root   root     10 2019-11-29 13:56 0 -> /data/data

versus

(Appsupport 10II, SFOS 4.5)

# ls /data/user -la
total 24
drwx--x--x  3 system system 4096 2023-02-02 16:05 .
drwxrwx--x 46 system system 4096 2023-06-11 00:46 ..
drwxrwx--x 73 system system 4096 2023-06-14 08:37 0

I’ve also tried to give full permissions to group and world on the applications data folder but still the file is not found. So in my opinion it has something to do with the mount vs. symlink difference between the new and old appsupport setup.

Cheers,
Nek

7 Likes

thanks for that investigation, thats a very interesting analysis

1 Like

I’ve got Element working fine after update to 4.5.0 (installed way back on earlier version).
So currently:

$ sudo ls -la /home/.android/data/user
total 20
drwx--x--x    3 501000   appsuppo      4096 Feb 13 16:13 .
drwxrwx--x   46 501000   appsuppo      4096 Jun 13 22:03 ..
drwx------    2 501000   appsuppo      4096 Feb 13 16:13 0
defaultuser@Xperia10III ~]$ sudo ls -la /home/.android/data/user/0
total 12
drwx------    2 501000   appsuppo      4096 Feb 13 16:13 .
drwx--x--x    3 501000   appsuppo      4096 Feb 13 16:13 ..

I actually do have the same values, so either this is the wrong directory, there is something going on with access rights when mounting this in appsupport, or there are other values different than the plain access rights.

Hello, not using element but wanted to have a try

This version opens up correctly and works on 4.5, maybe it will help someone

My bet on this: The former SFOS 4.4 installed RealmDB got its database config correctly installed and so after migration to SFOS 4.5 the database setup code opens an already completely initialized database file and starts working without issues.

The other case is when you install a new RealmDB application or re-install e.g. Element. The database needs to be fully initialized and this is where the shared database thread comes into play. That shared thread eventually is not needed on a completely initialized database so it won’t crash the RealmDB application at startup in contrast given an uninitialized database.

The bad thing here is that Elements RealmDB is encrypted with device specific keys so simply x-copying them from a working 4.4 device over to 4.5 will also crash the application (I tested that between my 4.4 and 4.5 device).

In a second I’ll repeat my x-copy test using a non-encrypted database file from one of the RealmDB examples and see if it will work on the 4.5 device.

1 Like