Bug 90341

Summary: x-systemd.automount,nofail on no existing device causes undesired side effects
Product: systemd Reporter: Martin Stolpe <martinstolpe>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTABUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: martinstolpe
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Martin Stolpe 2015-05-06 14:44:15 UTC
If I have a line like this in my fstab:
/dev/disk/by-uuid/c9ae0ba9-cf16-4d7c-b069-cab43a0529c6 /opt/somedir       ext4    defaults,x-systemd.automount,nofail 0 0
and then do a "ls /opt" the ls command will never finish (of course only if there is no device with that UUID). I can only guess that this is because systemd tries to mount the directory but the device does not exist.


Regards
Martin
Comment 1 Lennart Poettering 2015-05-06 15:33:57 UTC
Yes, systemd will wait for the device to appear. Everything else would be racy since during boot-up there's no guarantee that devices might have been probed by the time the first access might happen to the automount directory. Hence systemd must wait for the device to show up, and when it never does this will time out after 90s. You can shorten that timeout howver with the x-systemd.device-timeout= mount option in fstab.
Comment 2 Martin Stolpe 2015-05-06 15:43:30 UTC
I've changed the line like this:
/dev/disk/by-uuid/c9ae0ba9-cf16-4d7c-b069-cab43a052123  /opt/somedir/vivado_2015.2       ext4    defaults,x-systemd.automount,x-systemd.device-timeout=0,nofail 0 0
but ls still does not return.

I have created mount scripts that use the "ConditionPathExists=" option to check if the device is available before it gets mounted. Is this also possible with a fstab entry?

Should I use the mailing list for further questions?
Comment 3 Lennart Poettering 2015-05-06 15:53:52 UTC
setting the timeout to 0 actually makes it infinitely long... Set it to "1us" or so...

(In reply to Martin Stolpe from comment #2)
> I've changed the line like this:
> /dev/disk/by-uuid/c9ae0ba9-cf16-4d7c-b069-cab43a052123 
> /opt/somedir/vivado_2015.2       ext4   
> defaults,x-systemd.automount,x-systemd.device-timeout=0,nofail 0 0
> but ls still does not return.
> 
> I have created mount scripts that use the "ConditionPathExists=" option to
> check if the device is available before it gets mounted. Is this also
> possible with a fstab entry?

No, it is currently not available, and I don't think it will be added.

> Should I use the mailing list for further questions?

Well, if another issue pops up, sure...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.