systemd nfs automount


I have this fstab entry:       /home/akm/Diskstation/SL      nfs     noauto,rw,exec,x-systemd.automount 0 0       /home/akm/Diskstation/DL      nfs     noauto,rw,exec,x-systemd.automount 0 0

and this has worked perfect for several years, however since a while (not sure exactly when as I don’t need these nfs’s very often) one or both are not mounted anymore in KDE, clicking on them in dolphin gives that nice message that the mount is only permitted by root.

today only DL got mounted

journalctl -x -b | grep Diskstation
okt 01 15:30:05 caladan systemd[1]: Set up automount home-akm-Diskstation-SL.automount.
-- Subject: Unit home-akm-Diskstation-SL.automount has finished start-up
-- Unit home-akm-Diskstation-SL.automount has finished starting up.
okt 01 15:30:05 caladan systemd[1]: Set up automount home-akm-Diskstation-DL.automount.
-- Subject: Unit home-akm-Diskstation-DL.automount has finished start-up
-- Unit home-akm-Diskstation-DL.automount has finished starting up.
okt 01 15:37:47 caladan systemd[1]: home-akm-Diskstation-DL.automount: Got automount request for /home/akm/Diskstation/DL, triggered by 2615 (
okt 01 15:37:47 caladan systemd[1]: Mounting /home/akm/Diskstation/DL...
-- Subject: Unit home-akm-Diskstation-DL.mount has begun start-up
-- Unit home-akm-Diskstation-DL.mount has begun starting up.
okt 01 15:37:48 caladan systemd[1]: Mounted /home/akm/Diskstation/DL.
-- Subject: Unit home-akm-Diskstation-DL.mount has finished start-up
-- Unit home-akm-Diskstation-DL.mount has finished starting up.

status then shows:

/run/systemd/generator # systemctl status home-akm-Diskstation-SL.mount
● home-akm-Diskstation-SL.mount - /home/akm/Diskstation/SL
   Loaded: loaded (/etc/fstab; generated)
   Active: inactive (dead)
    Where: /home/akm/Diskstation/SL
     Docs: man:fstab(5)
/run/systemd/generator # systemctl status home-akm-Diskstation-DL.mount
● home-akm-Diskstation-DL.mount - /home/akm/Diskstation/DL
   Loaded: loaded (/etc/fstab; generated)
   Active: active (mounted) since Mon 2018-10-01 15:37:48 CEST; 1h 15min ago
    Where: /home/akm/Diskstation/DL
     Docs: man:fstab(5)
  Process: 2617 ExecMount=/usr/bin/mount /home/akm/Diskstation/DL -t nfs -o rw,exec,x-systemd.automount (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/home-akm-Diskstation-DL.mount

I don’t see any errors really, but it seems like something has changed in systemd somewhere that causes this to happen, as I said sometimes both are not mounted and sometimes one is not mounted.

manually workes just fine:

systemctl start home-akm-Diskstation-SL.mount
systemctl start home-akm-Diskstation-Dl.mount

so it really feels like maybe at boot the network is not ready in time (sometimes) and it then fails after which it’s game over ?

thanks for any idea’s you might have.

Are they mounted if you try to access directories directly on command line? “cd /home/akm/Diskstation/SL” or similar?

Try including option users. It allow the current user to mount the share in Dolphin here - but in LEAP 15, there’s no systemd option in the fstab entries so WMMV.

... nfs     noauto,**users**,rw,exec,x-systemd.automount 0 0

Also, I’d suppose the noauto and …automount options would conflict?

why not use autofs?


man 5 systemd.mount:

Mount units may either be configured via unit files, or via /etc/fstab (see fstab(5) for details). Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach. See systemd-fstab-generator(8) for details about the conversion.

When reading /etc/fstab a few special mount options are understood by systemd which influence how dependencies are created for mount points from /etc/fstab. systemd will create a dependency of type Wants from either or, depending whether the file system is local or remote. If x-systemd.automount is set, an automount unit will be created for the file system. See systemd.automount(5) for details. If x-systemd.device-timeout= is specified, it may be used to configure how long systemd should wait for a device to show up before giving up on an entry from /etc/fstab. Specify a time in seconds or explicitly specify a unit as “s”, “min”, “h”, “ms”.

If nofail is given, this mount will be only wanted, not required, by the This means that the boot will continue even if this mount point is not mounted successfully. Option fail has the opposite meaning and is the default.

If noauto is given, this mount will not be added as a dependency for This means that it will not be mounted automatically during boot, unless it is pulled in by some other unit. Option auto has the opposite meaning and is the default.

If a mount point is configured in both /etc/fstab and a unit file that is stored below /usr, the former will take precedence. If the unit file is stored below /etc, it will take precedence. This means: native unit files take precedence over traditional configuration files, but this is superseded by the rule that configuration in /etc will always take precedence over configuration in /usr.

As I read there, the x-systemd.automount and the noauto are different things that can coexist.

I also think that the users option is not needed. It is NOT a user mount. It is systemd that should detect that some process wants to access something inside the mountpoint directory and then mounts this. And systemd is already running as root.

And please do not forget that the OP reports that it did function as expected for quite some time. Thus his basic set-up seems to be correct.

that is a good one, I thought lets give it a try just for laughs, today DL was mounted but SL was not, df would only show the DL mounted.
As user I did the cd as you suggested and it got automounted without any issue and after that df shows it also.

I still think something has changed with systemd, maybe Network manager is not yet up or something like that, it feels a bit like a racing issue, I been looking into NetworkManager-wait-online.service and but still not sure about this. I guess a simple cd script in KDE startup would solve it.

But also seems that KDE/Dolphin does not really handle automount as one would think it should.

@hcvv, thanks you, it took me sometime years ago to get the right fstab and at first I also was not sure about noauto and automount :slight_smile: but as you said it worked pretty nice, if for some reason the nfs is not available it will be ignored at bootup.

okies, I tested the following:

fstab:       /home/akm/Diskstation/SL      nfs,noauto,rw,exec,x-systemd.automount 0 0       /home/akm/Diskstation/DL      nfs,noauto,rw,exec,x-systemd.automount 0 0

rebooted and a few things have changed

systemctl list-dependencies home-akm-Diskstation-SL.mount
● ├─-.mount
● ├─home.mount
● ├─system.slice
● └─

also the generated files in /run/systemd/generator have changed with that same info:

Documentation=man:fstab(5) man:systemd-fstab-generator(8)


so as expected, next thing was:

systemctl enable  NetworkManager-wait-online.service

reboot and DL was mounted but FS was not, more interesting though:

systemctl list-dependencies home-akm-Diskstation-SL.mount
● ├─-.mount
● ├─home.mount
● ├─system.slice
● └─
●   └─NetworkManager-wait-online.service

all with green dots so even if not mounted all seems fine dependency wise
So it seems it’s not networkmanager that is to late vs the mount

I guess a cheap cd script on KDE bootup will solve it, but still that seems cheap :wink:
Maybe it is a KDE issue and something changed there and systemd always worked this way… ?

Exactly. The problem is that the word “auto” combined with the word “mount” is used in many meanings. The result is that people talk about “automount” with some meaning in their mind where it is not sure that the listener gets the same image in his/her mind. A lot of confusion is the result.

We have here two things of the combination auto-mount (but there are more around, be aware):

  • The command
mount -a

will (try to) mount all entries in /etc/fstab. This is also happening at boot. When one does not want this (for whatever reason, but mostly because it is not sure the file system is available with a timeout as penalty) there is the file system independent mount option “noauto”.

  • The automounter (the configuration starts at /etc/auto.mount). To mount file systems when needed (and to umount them when not in use for a certain time). Originally often used in NFS environments, but later in Linux also for runtime (dis)connecting disks. The systemd automount is a replacement for this.

The humorous side of this is that when one uses automount, it is almost for sure that one then does not want the file system mounted at boot. The result is that noauto and automount (being it using the old auto.mount or the new systemd way) often will be used together (as you did). Further adding to the confusion between the meaning of “auto” (which is btw for many a synonym for “magic” ;)).

I tested a bit more last night, before login on KDE I checked (ctrl+alt+f1) and the nfs’s are not mounted, as I expected and wanted
so am starting to think something on the KDE front changed as in the past both nfs’s where available and now mostly just the 1.

its simply fixed with a simple script that is now autostarted with KDE:

#! /bin/sh

sleep 10

cd /home/akm/Diskstation/DL
cd /home/akm/Diskstation/SL

the sleep is needed, not sure why but it is :slight_smile:

I will log a report at KDE that is should sort of honor the systemd-automount instead of throwing the mount can only be done by root message in dolphin.

Thanks again for the help :slight_smile:

I am still interested in what KDE says. I do notunderstand what happens. The mount must be done as soon as some process needs a file/directory there. KDE should not have any influence on that. :question:

KDE sees mount point and thinks it needs to be mounted first?

Why? KDE is not the system manager.

And how? This is an fstab entry with no ‘user’ option. And I hope that KDE has no processes running with root as owner.

Also, while it is not impossible to find out (from fstab) which directories might be used as mount point, I do not think it is simple to “see mount points”.