[systemd-devel] [PATCH] fstab-generator: If we wait indefinitely for a mount, wait also for the device

Tom Gundersen teg at jklm.no
Fri Mar 1 09:38:51 PST 2013


On Fri, Mar 1, 2013 at 5:49 PM, Lennart Poettering
<lennart at poettering.net> wrote:
>> 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.

Yeah, when using systemd 'rootwait' is not really that useful, as we
can do better.

> 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?)

It prints "Waiting for root device..." but nothing after that.

> 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...

Well, there is "rootdelay=", but that just waits for the fixed amount
before even trying to mount, so that's not really helpful. Except for
that the kernel can't really do what we want here.

> 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...

Hm, yeah without an initramfs that is probably the least of two evils.

> 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.

Well, with systemd in the initramfs this is exactly what happens
without "rootwait": we get the standard systemd timeout before giving
up and giving the user a shell. With "rootwait" and Harald's patch we
will wait indefinitely like what the kernel does (unless I'm
misunderstanding something), which of course is less useful for the
reasons you give, so most people probably don't want to use this.

> 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...

I suppose the ideal situation would be to allow "rootwait=5min", but
that won't be compatible with initrd-less boot, so I'm not really in
favor of that.

-t


More information about the systemd-devel mailing list