[systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Apr 4 19:24:01 PDT 2014


On Fri, Apr 04, 2014 at 05:30:03PM -0400, Vivek Goyal wrote:
> On Fri, Apr 04, 2014 at 02:44:50PM +0800, WANG Chao wrote:
> > In kdump kernel, we need mount certain file system, and we use "nofail"
> > for all mounts specified in /etc/fstab. Because we don't want any mount
> > failure to interrupt the boot process to arrive at
> > dracut-pre-pivot.service (This is the point just before we switch root).
> > And at that dracut-pre-pivot, we run our kernel dump capture script
> > (called kdump.sh).
> > 
> > Our kdump.sh needs every .mount is mounted (or started in systemd
> > context) before it gets run by dracut-pre-pivot.service. And
> > dracut-pre-pivot.service is configured to run after local-fs.target. So
> > what we expect is no matter nofail is configured or not, local-fs.target
> > should be delayed after all mount units are started.
> > 
> > And it's also the same for remote nofail mounts and remote-fs.target.
> 
> Chao, will this change not force boot to stop if fsck on said device
> failed? And in that case we will not get a chance to run "default"
> action in kdump.
> 
> I think there is conflict in the definiton of "nofail" as defined by
> fstab/fsck and as interpreted by systemd fstab generator.
Current behaviour has an important reason: it is not possible to
implement "wait" mode without heavily penalising the case of missing
devices.  Since systemd boots rather quickly, it has not way of
knowing whether the device in question is genuinly missing, or just
slow to be detected, and has to wait the device timeout (3 min, iirc)
before continuing. In the light of this, current behaviour seems to be
a reasonable reinterpretation of "nofail" for an event-based boot
system.

Nevertheless, I understand the motivation for this patch, and this is
something that has been discussed before. What about adding an
local-fs-all.target, something like

[Unit]
Description=All local mount points configured in /etc/fstab

[Install]
WantedBy=multi-user.target

and having fstab-generator add Before=local-fs-all.target,
RequiredBy=local-fs-all.target to the units it generates. Then
if someone wants to wait for all local mounts, they can use
Requires=,After=local-fs-all.target.

And thanks to the [Install] section, a user can do
'systemctl enable local-fs-all.target' to wait for 'nofail' devices.

> To me systemd seems to be implementing mountall "nobootwait" which seems to 
> imply that boot does can continue without this mount being successful.
Yeah, it can do that because upstart does not really support dynamic boot,
and assumes that there's a point in time where "everything" is detected.

Zbyszek


More information about the systemd-devel mailing list