"/home" should be configurable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
New
|
Undecided
|
Unassigned |
Bug Description
At the moment, the path prefix "/home" is hardwired into snapd in a number of locations, e.g.
$ git clone https:/
$ cd snapd/
$ find * -type f -print0 | xargs -r0 fgrep -H '"/home'
cmd/snap-
cmd/snap-
cmd/snap/
dirs/dirs.go: SnapDataHomeGlob = filepath.
errtracker/
interfaces/
interfaces/
interfaces/
interfaces/
osutil/
osutil/
Would it not be possible to simply remove all occurrences of the string "/home" from the C and Go source code, and make is a run-time configuration variable? Or at least have an optional second home-directory path prefix that can be added at run-time as a configuration option?
For example something that can be set
* on the command line, as in
/usr/
* via a system options, such as
snap set system home-prefix /home
Ideal would be if a system-
AppArmour profiles do this already via /etc/apparmor.
Use of the prefix "/home" for home directory paths is incompatible with very common practice in centrally managed systems where home-directories are automounted from NFS servers.
For example, in our particular system (Department of Computer Science and Technology, University of Cambridge, several hundred users and workstations), the setup if as follows:
$ getent passwd mgk25
mgk25:*
$ echo $HOME
/home/mgk25
$ ls -l /home
lrwxrwxrwx 1 root root 5 Oct 22 23:35 /home -> homes
$ ls -l /homes
lrwxrwxrwx 1 root root 11 Oct 13 2008 /homes -> /auto/homes
$ ls -ld /auto/homes/mgk25
drwxr-xr-x 223 mgk25 mgk25 65536 Oct 23 17:02 /auto/homes/mgk25
$ findmnt $HOME
TARGET SOURCE FSTYPE OPTIONS
/auto/homes/mgk25 wulbor.
$ findmnt /auto/homes
TARGET SOURCE FSTYPE OPTIONS
/auto/homes auto_homes autofs rw,relatime,
$ cd ~ ; pwd -P
/auto/homes/mgk25
In other words:
- my $HOME contains two symbolic links in its path
- my $HOME is auto-mounted via either NFSv3 or NFSv4.1 using Kerberos authentication (sec=krb5p)
- my $HOME actually resides under /auto/homes/
The reasons we have these two symbolic links:
- /home -> /homes This link is in place on LAN-connected computers, where all
home directories are on the filer, to avoid local state on the local disk (which
can die any minute and is not backed up). However, on mobile computers, users may
have a local home directory under /home, and they still can access their automounted
filer-based home directories under /homes
- /homes -> /auto/homes Past experience has shown that auto-mounting /homes directly in the
root direxctory / can cause the entire root directory to block, and if '/' blocks,
everything locks up quickly, and the machine becomes unresponsive. Moving all automounts
into a subdirectory /auto of the root directory solved that problem, i.e. local OS components
that do not depend on the NFS home directories continue to work fine if the central
filer has a hick-up, and many things (e.g. sshd into a local home) still work fine.
So there are qite good reasons for the current setup that we are not keen to give up just to be able to use snaps.
I wonder: if there simply were a global configuration option for snapd that would allow me to replace the currently hard-wired path prefix "/home" with e.g. "/auto/homes", would all my current snap troubles would go away?
Current snap troubles:
a) snaps do not get "network inet/inet6" permissions, and therefore can't do NFS (the
attempted fix in https:/
another hardwired occurence of "/home").
b) if I manually override a) in AppArmor as described in bug #1662552, then I get
cannot perform operation: mount --rbind /home /tmp/snap.
(Is the latter error because /home is a symlink?)
> Is the latter error because /home is a symlink?
Yes, essentially this setup would work if instead of mounting at /auto/homes, your setup mounted directly at /home. Not being able to easily change the location of /home is a long-standing issue for which we already had discussion in https:/ /bugs.launchpad .net/snappy/ +bug/1620771 about. As such, I'm going to mark this as duplicate of that one.
As a workaround in addition to the workaround for a) that you tried, you could make /home a directory and not a symlink, it could just be an empty directory on the filesystem that "/" is mounted from, and just have something in /etc/fstab to bind mount /auto/homes onto /home (that then snapd would be able to mount as described into snap's mount namespaces).