Snapd 2.63 introduces a new feature where the home directory, either entire /home
or a specific /home/username
can be a cifs file system mounted from a samba share.
This system shares some of the same properties attributed to nfs-mounted home directory, with the additional problem that support for symbolic links is non-trivial and require either somewhat new kernel and samba (4.19+) or a very old and insecure samba (smb 1 protocol is not recommended but supports the same feature).
As with NFS-home, snapd detects the presence of such setup on startup, either as statically declared entry in /etc/fstab
or as a dynamic entry in /proc/self/mountinfo
. Given that network-mounted home directories are usually used in elaborate setups, both of those detection mechanisms may be insufficient, as the actual mount operation may happen after snapd has started (the test is performed only once).
Setting up the server
You need to use samba 4.19 or 4.20 (as tested). 4.19 is available in Ubuntu 24.04. The key thing to enable is smb3 unix extensions = yes
. Enabling extended attributes is nice but not required for snapd itself.
[alt-home]
comment = Alternative Home Directories
path = /alt/home
browseable = no
read only = no
create mask = 0755
directory mask = 0755
smb3 unix extensions = yes
ea support = yes
Setting up the client
On the client you need to use kernel 5.14 or newer, which should be easily supported by many releases. The file system must be mounted with specific options for everything to work correctly, those are:
vers=3.1.1
nomapposix
mfsymlinks
Gotchas
If snapd starts before the file system is started then snapd should be re-started. We are working on adding support for additional mechanism for enabling the cifs/nfs support mode even if there’s no clearly declared file remote system. This is done because in actual setups the mount operation can happen in non-obvious places, like pam
, and adding support for each possibility to snapd is most likely a bad idea.