I have my home directory at /z/home/$USER
, instead of at /home/$USER
, so I can have it on ZFS.
This upsets Snap packages to no end. When I try and run them, they say:
Sorry, home directories outside of /home are not currently supported. See https://forum.snapcraft.io/t/11209 for details.
When I go to that URL, I get a workaround, but not one described in sufficient detail to actually implement:
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.
The linked thread degenerates into discussion of what the design for properly supporting arbitrary home directories ought to be, and it is not immediately apparent to me how to implement the described workaround. I tried bind mounting /z/home/$USER
to also appear at /home/$USER
, and telling the Snap that that is my home directory, but my Snap package I want to run is still insisting that my home directory is bad and refusing to run:
$ sudo mkdir /home/$USER
$ sudo chown ${USER}:${USER} /home/$USER
$ sudo mount --bind /z/home/$USER /home/$USER
$ HOME=/home/$USER any-snap-package
Sorry, home directories outside of /home are not currently supported.
See https://forum.snapcraft.io/t/11209 for details.
How, exactly, does one go about implementing the workaround described by Michael Vogt in the linked Snapcraft forum thread? Or does the workaround not actually work?
It seems that
snap
gets its information on where your home directory is straight from/etc/passwd
and not from any other source. One workaround that I've been able to get mostly working involves using a Docker container to replace/etc/passwd
fromsnap
's point of view, with one that says my home directory is/home/$USER
.I'm sure there's a lighter-weight way to do this (maybe just a chroot?) that would negate the need for some of the other workarounds I needed to get
snap
to work inside a container, and I haven't tried it withminetest
, but here's the script I put together that runs theteatime
Snap without me having to actually move my home directory. Basically it starts a container withsnapd
in it, with all the places thatsnapd
keeps state mounted in from outside, but initialized with the base state of a freshly installedsnapd
(which is what it needs thelocal-persist
Docker volume driver for). Then it runssnap
in the container, as you, with all the X11 and DBUS plumbing wired up so thatteatime
can show its windows and desktop notifications.