6

Trying to use any snap package, I run into following issue:

$ gimp
cannot create user data directory: /local/home/user/snap/gimp/40: Read-only file system

(Gimp is just an example).

I have my $HOME in /local/home/$USER/ (I cannot change this!) and found that people have the same issue on the snap-store forum: https://forum.snapcraft.io/t/how-can-i-use-snap-when-i-dont-use-home-user/3352 and https://bugs.launchpad.net/snapcraft/+bug/1620771

In this thread, people say /home is hard-coded in snap and they suggest to use a bind-mount to solve this.

What I tried:

$ sudo mount --bind $HOME /home/$USER

ls correctly lists the content of my $HOME

$ ls /home/$USER

I also added the additional home dir to /etc/apparmor.d/tunables/home.d/my-homes:

$ cat /etc/apparmor.d/tunables/home.d/my-homes
@{HOMEDIRS}+=/local/home/

and to /var/lib/snapd/apparmor/snap-confine/my-homes:

$ cat /var/lib/snapd/apparmor/snap-confine/my-homes
mount options=(rw rbind) @{HOMEDIRS}/ -> /tmp/snap.rootfs_*/home/,

Running the snap again with bind-mount AND as well as OR changing files, the same error occurs as before.
How can I solve this ?


$ snap list gimp
Name  Version  Rev  Tracking  Developer     Notes
gimp  2.10.0   40   stable    snapcrafters  -

$ snap --version
snap    2.32.9
snapd   2.32.9
series  16
ubuntu  16.04
kernel  4.4.0-127-generic
pLumo
  • 26,947
  • Have you tried simply creating a symbolic link? Not saying that it works for sure but it is worth a try. (i.e. ln -s /local/home/username /home/username) – Videonauth May 25 '18 at 11:33
  • link gives the same error :-( – pLumo May 25 '18 at 11:37
  • O.k. was worth a try, sadly i not have much snap knowledge myself since i even deactivated snapd completely on my system. If youre keen on the absolute newest version of gimp from a ppa you can try http://ppa.launchpad.net/otto-kesselgulasch/gimp-edge/ubuntu which is well maintained and always holds the last version of gimp. – Videonauth May 25 '18 at 11:40
  • 1
    gimp is just the example here. The question is general, I have the same issue with all snaps. I already use that ppa, but it has 2.9 only for 16.04 ;-) – pLumo May 25 '18 at 11:41

2 Answers2

1

Snapd from 2.59 onward has a homedirs system option to deal with this issue. To upgrade to a working version you can use command:

snap refresh --channel=latest/edge snapd

I don't even have to set homedirs afterward, but just in case you can use:

snap set system homedirs=/local/home/

nakis
  • 31
-2

snapd developer here

I'm sorry that this is a problem for you, because you didn't give details about the version of snapd you are using (tip, run snap version and paste that here) or the detailed arrangement of what your real home directory is on (it sadly also matters).

I haven't personally tried this myself but you should be good enough with a bind mount like this:

sudo mount --bind /some/random/place/home/zyga /home/zyga

You can make this permanent if you add it to your /etc/fstab file. After this you must also change your home directory to really be in /home/zyga and not in the original location.

If this fails please snap install hello-world and add the output of the following commands:

SNAP_CONFINE_DEBUG=yes hello-world dmesg | grep DENIED

  • snapd is the version that is provided by the 16.04 repo (2.32.9). Unfortunately you must also change your home directory is not applicable for me as already explained in the question. – pLumo Jun 06 '18 at 12:03
  • 1
    Filed a bug: "Unable to start snap applications if user's home directory is not /home/$USER" https://bugs.launchpad.net/snapd/+bug/1776800 – Omegamormegil Jun 14 '18 at 02:20