Correct way to use SD-card with SailJail?

I’m currently putting the final touches on the Xperia XA2 I’ve acquired recently. This is also my first encounter with SailfishOS 4.4.0.72 (my old Xperia X was still on 4.3.0.x). I’m now running into issues with using the SD-card, which I think are related to SailFish. I’ve already got some information from the application thread, but I am wondering what the correct way of using and integrating the SD-card is. What I want to achieve:

  1. All music files on the SD-card
  2. All pictures taken with the camera on the SD-card

In the past, telling “Camera” to use SD-card combined with a symlink in the home directory to the SD-card was sufficient. Now, this approach no longer works, as the symlink is not accessible by the apps (e.g. by DeadBeef). Here’s what I’ve been able to establish so far:

  • Replacing the “Music” directory in $HOME with a symlink to SD-card/Music works fine - I can access all music files from deadbeef. Downside: the mediaplayer app now lists all music files twice - I assume that the tracker is searching in both $HOME/Music and $CARD/Music ?
  • I have the same issue with the “Pictures” directory - replacing it with a symlink to $CARD/Pictures makes all camera pictures accessible again to applications like Fernschreiber - but in return, the Gallery-app now lists all images twice, which is very annoying…

So, what is the proper way of handling this, if symlinks no longer work properly?

Why do you think you need any symlinks here?
It should just work (and has done for as long as i can remember).

Edit: found your motivation. Consider asking the author (nicely) to fix their app and don’t blame the OS.

Symlinks are a normal way of solving a situation like this on any Unix-/Linux-based OS, so that has been the standard approach for me. I"m not “blaming” anything (no idea how you get that idea), I’m asking how this is supposed to work in the current implementation of SailfishOS if the standard-Linux-way no longer is the right way to do it. Pointers to documentation are welcome.

1 Like

I still very much suggest you look at getting the apps fixed so you don’t need this shortcut/workaround to access the SD-card.

:point_down:

It is really not supposed to be needed, so it is up to you how you want it.
All that has happened is that you no longer have access to folders outside the standard/defined/named ones (and the sd card), depending on declared permissions of course.
You can put a symlink anywhere you do have access - and then convince tracker not to follow it or otherwise not look in both places (.nomedia file…). I don’t know why tracker didn’t follow your old symlinks… shouldn’t it have?

1 Like

Well, from what I gather from your explanations, that appears to be the correct way then. Nonetheless, this will take time and what I have tried so far is mostly intended as “quick-fix” so I can use the phone in the meantime. But see also below.

That was a stupid typo and should have read “SailJail” :rofl: Goes to show how important proofreading is… :+1: (FYI: I’ve been using SailfishOS-based phones as daily drivers since Jolla 1/SailfishOS 1.x)

Ok, maybe I need to clarify my way of thinking: of course I have the option to set it up any way I like (in fact, that is one of the reasons why I’m using SailfishOS as opposed to the more restricted mobile OSes); however, I prefer to at least try and understand what the developers had in mind when making certain changes. If I can make that fit with what I want to do then that is the best option - if not, I will look for alternative ways. I’m still “on the fence” w.r.t. SailJail - on the one hand, I understand the idea of locking down/securing the phones more, on the other hand, I normally prefer full control over my devices.

On <=4.3.0.x, I only had the one symlink to the SD-card - as Deadbeef and Cargo Dock could access $HOME, I could easily use that single sysmlink to access anything I wanted. On 4.4.0.x, that didn’t work, so I was experimenting with symlinking the actual directories (Camera itself does not need it, as you can simply configure it to use the SD-card directly) - but clearly, tracker sees the symlink and the actual location on $CARD as two separate locations, which is causing the issues described.

1 Like

Well, it is not really you that SailJail is locking out, but the apps (which you may of course want to use).
You are very much free to disable it for selected apps.
See e.g: What's up with Sandboxing? | Jolla Blog
You can also arbitrarily edit the permissions in /etc/sailjail/permissions/, for example adding your symlink. (A link inside some directory where it is already readable still sounds like a much better idea)

So i can’t see that there is a conflict here.
All i’m arguing is that the better user experience is to have to do neither since very few use-cases actually need more than is allowed/allowable. It is just a crutch.

I still very much wonder about this, since you seem to say the duplicates were a new problem despite a same-enough solution. Or am i missing something?

1 Like

I have to re-try that one (as I do agree with you) - I had issues with this set-up, but see below.

At least in an ideal world where all apps have been suitably modified. Until then, I will need these work-arounds (disabling SailJail in my eyes is just another workaround, same as links).

Hm - maybe I did not describe it clearly enough, let me try again. Let me fire up my Xperia X (still on 4.3.0.15) and check. Here’s what I used:

4.3.0.15 and lower

  • Symlink SD-card -> $CARD in $HOME
  • The directory $HOME/Pictures/Camera is a symlink to ../SD-card/Pictures/Camera (actually, I forgot that I had this on 4.3.0.x already)
  • The Camera app is configured to use the SD-card (i.e. all images end up in $CARD/Pictures/Card)
  • From within apps (Cargo Dock, Fernschreiber) I can access the photos via Camera without issues
  • The Gallery app shows each photo only once

4.4.0.72, Configuration 1

  • Symlink SD-card -> $CARD in $HOME
  • The directory $HOME/Pictures is a symlink to SD-card/Pictures
  • The Camera app is configured to use the SD-card (i.e. all images end up in $CARD/Pictures/Card)
  • From within apps (Cargo Dock, Fernschreiber) I can access the photos via Camera without issues
  • The Gallery app shows each photo twice

Ok, now you got me really thinking… Let’s try that sub-directory-link scenario once more:
4.4.0.72, Configuration 2

  • Symlink SD-card -> $CARD in $HOME
  • The directory $HOME/Pictures/Camera is a symlink to ../SD-card/Pictures/Camera
  • The Camera app is configured to use the SD-card (i.e. all images end up in $CARD/Pictures/Card)
  • From within Fernschreiber, I can access the photos via Camera without issues
  • From Cargo Dock, I cannot see the Camera-directory anymore. In he Pictures-directory, the symlink is not visible. I have no way to access photos.
  • The Gallery app shows each photo only once.

I think that I will use this configuration for now, with SailJail disabled for Cargo Dock (then, it does show the Camera-directory) - for me, that actually makes sense, as I expect a file manager to show me all directories.

That means that I have a working (for me) configuration for the time being and I’ve learned a thing or two about SailJail - thank you! :+1:

(Edit: corrected some typos)

1 Like