Symlinked $HOME break snaps Ubuntu 20.04 (Solved)

Well… @allen-munsch it looks like you have unnecessary complicated ways to « store » your data.

You should not move /home/$USER. Nor having a separate /home partition.

Just let /home/… sits at the root of your system.

And prefer having another partition where you store what you want, mounted in a place snap is able to access :
⋅ /home
⋅ /media
⋅ /run/media
⋅ /mnt
…if a given snap app has been connected to removable-media and home interface.
see https://snapcraft.io/docs/removable-media-interface or https://snapcraft.io/docs/home-interface

In /etc/fstab a bind mount will look like :

/path_to/ressource/folder/	/path_to/destination/folder	none	bind

Roughly a bind-mount is 2 folders showing the same ressource.

Example, here are my discs and partitions :

django@ASGARD:~$ lsblk -fe7 -o +size
NAME   FSTYPE LABEL     UUID                                 FSAVAIL FSUSE% MOUNTPOINT    SIZE
sda                                                                                     931,5G
└─sda1 ext4   DATA      b19322e6-8a6d-4e24-b87f-4b0155b41963  320,1G    60% /media/DATA 930,8G
sdb                                                                                     111,8G
├─sdb1 ext4   Budgie    25c341fb-320d-4a4a-9d64-b08c5fe55540    7,3G    75% /            37,3G
├─sdb2                                                                                      1K
├─sdb5 ext4   System_02 384c7fbb-8785-4c06-9053-790ad27cc3bf                             37,3G
└─sdb6 ext4   System_03 c3e7a588-524b-4a46-bbf9-cc63cdc5db28                             37,3G
sr0 

my fstab :

django@ASGARD:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
#
# / [ sda1 sur ssd ]
UUID=25c341fb-320d-4a4a-9d64-b08c5fe55540	/	ext4	errors=remount-ro	0	1
#
# DATA
UUID=b19322e6-8a6d-4e24-b87f-4b0155b41963	/media/DATA	ext4	defaults	0	2
#
# fichier d'échange
/swapfile                                 none            swap    sw              0       0
#
# vignettes .xcf et gimp snap
/home/django/.cache/thumbnails/	/home/django/snap/gimp/common/.cache/thumbnails/	none	bind
#

and how is organized my personal folder /home/$USER

django@ASGARD:~$ ls -l
total 4
lrwxrwxrwx 1 django django   29 avril 10  2020 Bureau -> /media/DATA/coeurnoir/Bureau/
lrwxrwxrwx 1 django django   31 avril 16  2020 Documents -> /media/DATA/coeurnoir/Documents
lrwxrwxrwx 1 django django   29 avril 10  2020 Images -> /media/DATA/coeurnoir/Images/
lrwxrwxrwx 1 django django   31 janv. 18 18:08 Logiciels -> /media/DATA/coeurnoir/Logiciels
lrwxrwxrwx 1 django django   30 avril 11  2020 Modèles -> /media/DATA/coeurnoir/Modèles
lrwxrwxrwx 1 django django   49 avril 10  2020 Musique -> '/media/DATA/Bibliothèque Musicale/Bibliothèque/'
drwxrwxr-x 7 django django 4096 mai    3 21:12 snap
lrwxrwxrwx 1 django django   39 avril 11  2020 Téléchargements -> /media/DATA/coeurnoir/Téléchargements
lrwxrwxrwx 1 django django   30 avril 10  2020 Vidéos -> /media/DATA/coeurnoir/Vidéos/

With such settings, all my snaps connected to removable-media interface do access what’s visible inside my personal folder, even if those are symlinks.

Of course it implies your $USER has correct rights and permissions to deal with the targets of symlinks.

As you can see there is one folder I did not try to move nor symlink ~/snap
This one has to stay there, in the root tree of your system, in /home/$USER

1 Like