[systemd-devel] How can I set timeout limits on root device searching when booting?

Tomasz Pala gotar at polanet.pl
Wed Nov 29 06:54:11 UTC 2023


On Thu, Nov 16, 2023 at 17:51:35 +0800, cunshunxia wrote:

> With 'e' pressed at boot menu, I set the `root=UUID=[wrong UUID]` in boot cmdline. Then I expect that I will run into emergency mode.However, boot log stuck at `Job dev-disk-by\x2duuid-XXXX-device/start running(5min 10s/ no limit)`.
> I tried DefaultDeviceTimeoutSec=90s, but it doesn't work.

This is your initrd-generator issue, not systemd. E.g. for dracut
there are rd.retry= and rd.timeout=<seconds> parameters (but there were
some bugs in handling them, I recall fixing this myself in my systems),
defaulting and overriding DefaultDeviceTimeoutSec= to infinity.

> In addition, if I set a wrong uuid of root device in fstab, the system will boot up with read-only filesystem instead of running into emergency mode even if I didn't set 'nofail'.

Again, if you use dracut, it _HEAVILY_ modifies the systemd flow
(including modifying some provided units), especially in regards of
handling initqueue and things like composed block devices activation.

With modified fstab but without regenerating initrd some weird things
are expected to happen, just because your initrd has different (proper?)
view of the system.

In short: your questions are way too general to be answered here.
Unless you use mkosi.

> Is there any way that I can set the timeoutsec or how can I run into emergency mode if root device is set incorrectly?

If you do use dracut, then I warn you it is very peculiar and interferes
with documented expectations. I personally have dozens of changes to
it's scripts just to make it behave correctly.

And so you should ask these questions on your initrd maillist first.

-- 
Tomasz Pala <gotar at pld-linux.org>


More information about the systemd-devel mailing list