Support for non /home homedirs

Snapd does currently not support running snaps if the home directory of the user is outside of /home. This is discussed here here.

A workaround is to bind mount the home directory outside /home into /home.

1 Like

does not work for me. And I still don’t no why.

Hi, can you be more specific? What did you try to bind mount your home directory from outside /home to /home/somewhere ?

Hi,

I typed
sudo mount --bind /media/daten/home/robert /home/robert

and tried to get mailspring working, which I’ve installed via snap.

Still getting this error Message:
cannot create user data directory: /media/daten/home/robert/snap/mailspring/488: Permission denied

I’m at the same Point as this guy here: https://askubuntu.com/questions/1207472/how-do-you-actually-run-a-snap-package-when-your-home-directory-isnt-under-h

I did the stuff this guy is telling here: https://askubuntu.com/questions/1040194/how-to-use-snap-packages-when-home-is-not-home-user

Read all the other Posts on this Topic - the Internet is full of it, including this: https://utcc.utoronto.ca/~cks/space/blog/linux/Ubuntu2004SnapsHomeIssue?

snap    2.45.2
snapd   2.45.2
series  16
ubuntu  18.04
kernel  4.15.0-112-generic

Did you also adjust your user account’s home folder location to be /home/$USERNAME via the passwd database once you’d made the appropriate bind-mount making the folder appear there? If you didn’t then snapd will continue to think your home folder is under /media and will attempt to use that path. You need to make the requisite bind-mounts to make a home folder appear at /home/$USERNAME AND change the passwd database to point to that location if it is currently set to the non-/home location.

Did you connect your mailspring-snap to the removable-media interface ?

snap connections mailspring

to check.

Given the other comments here, and specifically How can I use snap when I don't use /home/$USER?, I think that this post should be updated to say make a bind mount, and also update the passwd database, i.e. /etc/passwd as @daniel proposed. Also I think we should make this post into the docs category so it is editable. Unclear if we want this to go to the snapcraft.io/docs or not however

@degville thoughts on expanding a bit on this and putting it into the docs category and potentially also putting it on snapcraft.io/docs ?

1 Like

I think this is a good idea - thanks @ijohnson. I’ll create something to explain the situation and include the above possible solutions.

1 Like

It looks like:

removable-media           mailspring:removable-media           :removable-media                -

Hi,

I was on vacation.

Did now all this, what is written down here: https://forum.snapcraft.io/t/how-can-i-use-snap-when-i-dont-use-home-user/3352/20?u=zickzack

My Home folder finally moved. Restarted the Computer twice.

Typing:

robert@robert-desktop:~$ mailspring
cannot create user data directory: /home/robert/snap/mailspring/488: Permission denied

What now?

Can you show system journal denials with journalctl -e --no-pager | grep DENIED ?

Hi, thanks for answering.

I just putted out the two denials for snap:

Aug 03 15:17:44 robert-desktop audit[25376]: AVC apparmor="DENIED" operation="open" profile="/snap/core/9665/usr/lib/snapd/snap-confine" name="/home/" pid=25376 comm="snap-confine" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 03 15:17:44 robert-desktop kernel: audit: type=1400 audit(1596460664.725:2109): apparmor="DENIED" operation="open" profile="/snap/core/9665/usr/lib/snapd/snap-confine" name="/home/" pid=25376 comm="snap-confine" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

This denial is unexpected since the snap-confine policy should have this rule: @{HOMEDIRS}/ r, with /etc/apparmor.d/tunables/home setting @{HOMEDIRS} to @{HOMEDIRS}=/home/.

What is the output of ‘grep -r HOMEDIRS /etc/apparmor.d/tunables’ ?

It’s
/etc/apparmor.d/tunables/home.d/my-homes:@{HOMEDIRS}+=/media/daten/home/ /etc/apparmor.d/tunables/home.d/site.local:# here are appended to @{HOMEDIRS}. See tunables/home for details. Eg: /etc/apparmor.d/tunables/home.d/site.local:#@{HOMEDIRS}+=/srv/nfs/home/ /mnt/home/ /etc/apparmor.d/tunables/home.d/Home:@{HOMEDIRS}+=/media/daten/home/ /etc/apparmor.d/tunables/home.d/ubuntu:# here are appended to @{HOMEDIRS}. See tunables/home for details. /etc/apparmor.d/tunables/home.d/ubuntu:@{HOMEDIRS}+=/media/daten/home/ /etc/apparmor.d/tunables/home:@{HOME}=@{HOMEDIRS}/*/ /root/ /etc/apparmor.d/tunables/home:# @{HOMEDIRS} is a space-separated list of where user home directories /etc/apparmor.d/tunables/home:@{HOMEDIRS}=/media/daten/home/ /etc/apparmor.d/tunables/home:# @{HOMEDIRS}.

Possibly I changed it during my search for the snap Solution…

Ok, thanks for the hint.

I changed all my databases in /etc/apparmor.d/tunables to the right home folder and now— finally, it works.

Thanks for all the help!

2 Likes