You are not logged in.

#1 2020-05-21 09:47:59

radmac
Member
Registered: 2019-03-12
Posts: 4

NFS - systemd automount [SOLVED]

Hi,

I have a NFS server running on my (privat) local network (at home).
To automount it I have following line in my /etc/fstab:

odroid_lan:/srv/nfs /home/rad/_mount/odroid_nfs nfs rw,user,noauto,async,noatime,_netdev,x-systemd.automount,x-systemd.device-timeout=10s,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10min,x-systemd.requires=network-online.target 0 0

where odroid_lan is defined in /etc/hosts as:

192.168.0.100 odroid_lan.localdomain odroid_lan

As long as I am connected to my private local network it works just fine. However if I am not and enter /home/rad/_mount directory (or just list it) systemd tries to connect to the nfs server (which it obviously can not), but instead to timeout after 10s (as defined with x-systemd.mount-timeout) it hangs for I don't know how long (I never have a patience to wait that long, but definitely longer than an hour).

The journal is then full of:

kvě 21 10:40:34 book kernel: nfs: server odroid_lan not responding, timed out
kvě 21 10:40:43 book kernel: nfs: server odroid_lan not responding, timed out
kvě 21 10:40:51 book kernel: nfs: server odroid_lan not responding, timed out

So it can be that it actually time out after 10 s (even though the time interval is not consistent and sometimes shorter than 10 s), however tries over and over again.

Here is a reminder from man page:

x-systemd.device-timeout=
   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 append a unit such as "s", "min", "h", "ms".

x-systemd.mount-timeout=
   Configure how long systemd should wait for the mount command to finish before giving up on an entry from /etc/fstab.
   Specify a time in seconds or explicitly append a unit such as "s", "min", "h", "ms".
   See TimeoutSec= below for details.

TimeoutSec=
   Configures the time to wait for the mount command to finish.
   If a command does not exit within the configured time, the mount will be considered failed and be shut down again.
   All commands still running will be terminated forcibly via SIGTERM, and after another delay of this time with SIGKILL.
   (See KillMode= in systemd.kill(5).)
   Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass 0 to disable the timeout logic.
   The default value is set from DefaultTimeoutStartSec= option in systemd-system.conf(5).

x-systemd.idle-timeout=
   Configures the idle timeout of the automount unit. See TimeoutIdleSec= in systemd.automount(5) for details.

TimeoutIdleSec=
   Configures an idle timeout. Once the mount has been idle for the specified time, systemd will attempt to unmount.
   Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass 0 to disable the timeout logic.
   The timeout is disabled by default.

Any help will be appreciated.

Last edited by radmac (2020-05-22 07:21:16)

Offline

#2 2020-05-22 00:18:12

fukawi2
Administrator
From: .vic.au
Registered: 2007-09-28
Posts: 5,906
Website

Re: NFS - systemd automount [SOLVED]

Emphasis added by me:

man.systemd.mount wrote:

The NFS mount option bg for NFS background mounts as documented in nfs(5) is detected by systemd-fstab-generator and the options are transformed so that systemd fulfills the job-control implications of that option. Specifically systemd-fstab-generator acts as though "x-systemd.mount-timeout=infinity,retry=10000" was prepended to the option list, and "fg,nofail" was appended. Depending on specific requirements, it may be appropriate to provide some of these options explicitly, or to make use of the "x-systemd.automount" option described below instead of using "bg".

I can't find any more documentation about the "retry" option (in the context of a systemd mount) but perhaps try explicitly setting it to 1 in your fstab options?

Offline

#3 2020-05-22 07:18:41

radmac
Member
Registered: 2019-03-12
Posts: 4

Re: NFS - systemd automount [SOLVED]

fukawi2 wrote:

I can't find any more documentation about the "retry" option (in the context of a systemd mount) but perhaps try explicitly setting it to 1 in your fstab options?

That actually works! I can't believe I missed it. Thank you.

# ls /home/rad/_mount on LAN
kvě 22 08:14:52 book systemd[1]: home-rad-_mount-odroid_nfs.automount: Got automount request for /home/rad/_mount/odroid_nfs, triggered by 2352 (ls)
kvě 22 08:14:52 book systemd[1]: Mounting /home/rad/_mount/odroid_nfs...
kvě 22 08:14:52 book kernel: FS-Cache: Netfs 'nfs' registered for caching
kvě 22 08:14:52 book kernel: *** VALIDATE nfs ***
kvě 22 08:14:52 book kernel: *** VALIDATE nfs4 ***
kvě 22 08:14:52 book systemd[1]: Mounted /home/rad/_mount/odroid_nfs.
kvě 22 08:24:53 book systemd[1]: Unmounting /home/rad/_mount/odroid_nfs...
kvě 22 08:24:53 book systemd[1081]: home-rad-_mount-odroid_nfs.mount: Succeeded.
kvě 22 08:24:53 book systemd[1]: home-rad-_mount-odroid_nfs.mount: Succeeded.
kvě 22 08:24:53 book systemd[1]: Unmounted /home/rad/_mount/odroid_nfs.

# ls /home/rad/_mount outside LAN
kvě 22 08:43:26 book systemd[1]: home-rad-_mount-odroid_nfs.automount: Got automount request for /home/rad/_mount/odroid_nfs, triggered by 3867 (ls)
kvě 22 08:43:26 book systemd[1]: Mounting /home/rad/_mount/odroid_nfs...
kvě 22 08:43:36 book systemd[1]: home-rad-_mount-odroid_nfs.mount: Mounting timed out. Terminating.
kvě 22 08:43:36 book systemd[1]: home-rad-_mount-odroid_nfs.mount: Mount process exited, code=killed, status=15/TERM
kvě 22 08:43:36 book systemd[1]: home-rad-_mount-odroid_nfs.mount: Failed with result 'timeout'.
kvě 22 08:43:36 book systemd[1]: Failed to mount /home/rad/_mount/odroid_nfs.

There is however one teeny-tiny thing. If I try to open /home/rad/_mount directory in Doplhin (I use KDE), it times out as with ls and the nfs directory odroid_nfs is not shown. In Krusader (which I actually use) however, it tries to connect six times (or within one minute timeout) until it finaly enter the directory. The nfs directory odroid_nfs is listed. The difference is that while for the Dolphin the triggering proces is file.so, for Krusader it is krusader itself. I will try to discuss this at more relevant place...

Offline

Board footer

Powered by FluxBB