[systemd-devel] [PATCH] fstab-generator: If we wait indefinitely for a mount, wait also for the device
Lennart Poettering
lennart at poettering.net
Fri Mar 1 08:49:29 PST 2013
On Fri, 01.03.13 16:32, Tom Gundersen (teg at jklm.no) wrote:
> >> > Hmm, this hooks into "wait", which is initialized from the kernel
> >> > cmdline rootwait? What are the precise semantics of the kernel there
> >> > regarding this flag, in a non-initrd case? We probably should mimic the
> >> > kernel here is good as we can...
> >> >
> >> > So, in the non-initrd case: what does rootwait do on the kernel cmdline?
> >> > And what happens if it is not used?
> >>
> >> rootwait [KNL] Wait (indefinitely) for root device to show up.
> >> Useful for devices that are detected asynchronously
> >> (e.g. USB and MMC devices).
> >
> > Yeah, that's what I read, too, but I cannot make sense of it. See above:
> > what is different from when it is not used? Or to be precise: what does
> > the kernel precisely do when rootwait is *not* passed?
>
> When rootwait is not passed the kernel calls sys_mount() immediately
> (after the equivalent of "udevadm settle") assuming the device will be
> there, failing if it is not. Otherwise, if rootwait is called, the
> kernel will wait (possibly indefinitely) for the device to appear
> before attempting to mount it.
>
> Setting JobTimeout=0 on the device seems correct to me.
I don't really agree. The difference between the kernel and the initrd
in this regard is that the initrd can offer the user a shell, he can
debug things with. The naked kernel cannot do this. If the root device
doesn't show up we should give the user a shell, so we should timeout
this.
Now, without "rootwait" the kernel currently just does the equivalent of
"udev settle" by default, and then oopses. This will give the user some
feedback, and might be incompatible with some really slow USB devices
and such like. By passing "rootwait" it would wait indefinitely, if i
understood this correctly, and it wouldn't generate any message (or
would it?) Ideally, I'd actually like to see a configurable timeout:
i.e. wait for 5min, then give up, and print a msg and oops, or so...
In the meantime I am leaning towards suggesting that people should
always use "rootwait", since if i can choose between "kernel crashed
hard", and "things might still unfuck themselves if we are lucky", then
I'd always choose the latter, if you understand what I mean...
But anyway, to bring this back to the original question: I think we
really should time-out looking for the root dir, and generate an error,
and give the user the option for a shell, that's better than just
sitting there forever, and sticking the head in the sand.
The only time we want to turn off the timeouts, is really when we are
waiting for user input, which is specific to cryptsetup stuff, which
this patch isn't about...
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list