Hello lovely people.
I've done some investigation on both solus and another distro and the preliminary conclusion is that there is an issue in upstream systemd 244 that causes generated network automounts to fail (generated local automounts work fine).
The workaround is to use systemd .mount and .automount files and enable the .automount unit.
Here's an example of how to translate an /etc/fstab cifs mount to systemd .mount and .automount units and enable it:
# /etc/fstab samba mount
//dante.lan/media_stash /mnt/dante/media_stash cifs noauto,_netdev,x-systemd.automount,guest,sec=ntlmssp
Contents of the equivalent /etc/systemd/system/mnt-dante-media_stash.mount
file:
[Unit]
Description=Dante media_stash share
[Mount]
What=//dante.lan/media_stash
Where=/mnt/dante/media_stash
Type=cifs
Options=guest,sec=ntlmssp
[Install]
WantedBy=multi-user.target
Corresponding /etc/systemd/system/mnt-dante-media_stash.automount
file:
[Unit]
Description=Dante media_stash share automount
[Automount]
Where=/mnt/dante/media_stash
[Install]
WantedBy=multi-user.target
Ask systemd to re-read all unit files from disk with sudo systemctl daemon-reload
.
Tell systemd to enable the .automount file with sudo systemctl enable --now mnt-dante-media_stash.automount
. Do NOT enable the .mount file!
Fire off a mount
invocation and check that the equivalent to the following line appears:
systemd-1 on /mnt/dante/media_stash type autofs (rw,relatime,fd=23,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=25144)
If the above line appears, the automount works. Navigate to the mount with cd /mnt/dante/media_stash/
and check that it is now correctly mounted with another mount
invocation:
$ cd /mnt/dante/media_stash/
ermo@rocinante:/mnt/dante/media_stash
$ mount
(... output truncated for brevity ...)
systemd-1 on /mnt/dante/media_stash type autofs (rw,relatime,fd=23,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=25144)
//dante/media_stash on /mnt/dante/media_stash type cifs (rw,relatime,vers=3.1.1,sec=ntlmssp,cache=strict,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.222,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
Substitute with appropriate syntax and options for nfs mounts.
EDIT: A note about mounts with dashes -
in their names from someone on IRC:
siru | ermo: it works -- many thanks
siru | the only hassle were mount points with a dash "-"
siru | systemd unit files do not like that
siru | systemd-escape --path "/the/path" does help
In short, it's probably a good idea to avoid dashes -
in mount points and use underscores _
instead...