So, two things.
First: Linux and Unix have a Filesystem Hierarchy Standard which Ubuntu and Snaps follow.
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
Second: If one chooses to deviate from the worldwide standard that has been in place since 1979, that's perfectly fine, but then bind mount your non-standard directory so that snap can find it.
mount --bind /nonstandard_mountpoint /media/$USER/directory
or
mount --bind /nonstandard_mountpoint /home/$USER/directory
then you can continue to use your nonstandard mountpoint AND at the same time all your snaps can find your nonstandard_mountpoint data.
It's even possible to make this mount permanent by adding it to your FSTab
sudo nano /etc/fstab
append the line
/source /destination none defaults,bind 0 0
to save and exit
CTRL+X y
here is an example:
Music files stored at /srv/dsmusic
first create a directory at /home/$USER/Music/dsmusic
mkdir /home/$USER/Music/dsmusic
then bind mount /srv/ds music to that directory
sudo mount --bind /srv/dsmusic /home/$USER/Music/dsmusic
Then all your snap music programs will auto magically find the music files.
to contine the Music example:
sudo nano /etc/fstab
append the line
/srv/dsmusic /home/username/Music/dsmusic none defaults,bind 0 0
** Unmounting **
if you want to unmount you can use the regular umount command like a regular mountpoint
sudo umount /home/$USER/Music/dsmusic
For more information please see:
https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount
SystemD
** Please note that there is a more modern way to do this in SystemD instead of using fstab.
To create bind mounts in SystemD you need to create a .mount file with the path to the nonstandard mountpoint separated by - (minus) instead of forward slashes (/)
sudo systemctl edit --full --force path-nonstandard.mount
past the following and edit the mountpoints
[Unit]
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
[Mount]
What=/some/old/dir
Where=/the/new/dir
Type=none
Options=bind
[Install]
WantedBy=local-fs.target
if nano is the default editor
CTRL+X y (for nano)
:wq (for vim)
enable the systemD file
sudo systemctl enable path-nonstandard.mount
then reload the SystemD daemon
sudo systemctl daemon-reload
Then start your mount with
sudo systemctl start path-nonstandard.mount
If you need to modify it again just
sudo systemctl edit --full path-nonstandard.mount
Example:
To use the Music example again:
sudo systemctl edit --full --force srv-dsmusic.mount
this will open a blank editor and create a new .mount file in the correct system folder to which one adds the lines
for a local mountpoint on the same hardware:
[Unit]
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
[Mount]
What=/srv/dsmusic
Where=/home/username/Music/dsmusic
Type=none
Options=bind
[Install]
WantedBy=local-fs.target
please note that if your non-standard mountpoint is a NAS or other remote device you'll need to use remote-fs.target and not local-fs.target
for a remote mountpoint on different hardware such as a NAS
[Unit]
DefaultDependencies=no
Conflicts=umount.target
Before=remote-fs.target umount.target
[Mount]
What=/srv/dsmusic
Where=/home/username/Music/dsmusic
Type=none
Options=bind
[Install]
WantedBy=remote-fs.target
then exit the editor
CTRL+X y (for nano)
:wq (for vim)
enable the systemD file
sudo systemctl enable srv-dsmusic.mount
Then reload the systemD daemon
sudo systemctl daemon-reload
then start your new mountpoint
sudo systemctl start srv-dsmusic.mount
to unmount the bindmount just
sudo systemctl stop srv-dsmusic.mount
You now be able to find mirrors of your data at /srv/dsmusic as well as snap will be able to find the same data at /home/$USER/Music/dsmusic
for more information please see: https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdBindMountUnits
and
https://www.freedesktop.org/software/systemd/man/systemd.mount.html
sudo snap remove vlc
) then reinstall with the classic option. May help, may not.. (sudo snap install vlc --classic
)--classic
and--devmode
- neither worked. But also I want to give access explicitly to/store
but not everything like/supersecret