FS#18413 - [mkinitcpio] default rootdelay waits 10 seconds every boot

Attached to Project: Arch Linux
Opened by Paul Seropian (paranoos) - Saturday, 20 February 2010, 21:04 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 21 February 2010, 17:44 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The default rootdelay in mkinitcpio is to wait 10 seconds, and does not allow the setting of rootdelay=0 (must wait at least 1 second). My system does not require any delay, however it waits a full 10 seconds (the delay is NOT short-circuted as soon as the system is ready). IMO, default should be no delay, and those who require it can set whatever delay they wish in grub/lilo.

This change in behaviour is very simple to implement:
/lib/initcpio/init:
Change "export rootdelay=10" to "export rootdelay=0". This sets the default to no delay

/lib/initcpio/init_functions:
change "if [ "$2" -gt 0 ]; then" to "if [ "$2" -ge 0 ]; then". This allows the setting of no delay.

Rebuild initcpio (easiest way is to pacman -S kernel26).

http://bbs.archlinux.org/viewtopic.php?id=74563
This task depends upon

Closed by  Thomas Bächler (brain0)
Sunday, 21 February 2010, 17:44 GMT
Reason for closing:  Fixed
Comment by Roman Kyrylych (Romashka) - Saturday, 20 February 2010, 21:20 GMT
It doesn't wait here (I didn't override the default rootdelay).
:-/
Comment by Ionut Biru (wonder) - Saturday, 20 February 2010, 21:49 GMT
it doesn't wait if the device is generated. maybe is useful if you post mkinitcpio.conf
Comment by Paul Seropian (paranoos) - Saturday, 20 February 2010, 21:51 GMT
hmm
i just tested it again after overwriting my changes, and it does in fact wait.

perhaps it is due to my unusual mkinitcpio config? i don't like any "auto" configs, so i set it up manually like so:

MODULES="sata-nv sd-mod ext4"
BINARIES=""
FILES=""
HOOKS="base"

perhaps one of the default hooks that i am not using is responsible for short-circuting the wait time.
Comment by Roman Kyrylych (Romashka) - Saturday, 20 February 2010, 23:10 GMT
add udev to HOOKS and see if it helps
Comment by Paul Seropian (paranoos) - Saturday, 20 February 2010, 23:48 GMT
adding the udev hook killed the delay.
Comment by Roman Kyrylych (Romashka) - Sunday, 21 February 2010, 00:36 GMT
Hm, looks like the while loop in poll_device() doesn't break when root device appears on your system, but I don't see a bug in it. :-/
Comment by Thomas Bächler (brain0) - Sunday, 21 February 2010, 00:51 GMT
Only setups without udev will have this problem. Setups that use udev will only wait if the device has not been created yet. However, I don't think we should force everyone to use udev in initramfs.

We should do two things:
1) Allow a delay of 0s. This may make sense for some people, but with 2) below shouldn't be necessary any more.
2) Do not "wait" for a device node in poll_device when udev is not running.

This is both trivial to implement and will be fixed before I release the next mkinitcpio version, so stay tuned.
Comment by Paul Seropian (paranoos) - Sunday, 21 February 2010, 00:53 GMT
hmm maybe this will help; I believe the message "Root device '/dev/sda1' doesn't exist. Attempting to create it." appears whenever I boot. It looks like this message is printed if poll_device fails when it is called from /lib/initcpio/init.

So probably not a bug in poll_device itself.

ahh, I was in the middle of typing this when Thomas responded. Thanks, that sounds like it will definitely solve the problem. :)
Comment by Thomas Bächler (brain0) - Sunday, 21 February 2010, 01:09 GMT
Here you go:
1) http://projects.archlinux.org/mkinitcpio.git/commit/?id=c73baee87913e6e92f0cb82d1f999528b51c7bb7
2) http://projects.archlinux.org/mkinitcpio.git/commit/?id=ae65c7cc9577747104d2e7e9563a49f9f850eef9

Patch 2 should fix the behaviour as you expect it: If udev has not been launched (because it is not included), poll_device will exit instantly with the correct return value (false in your case) and the device will be created. There should be no need to set any rootdelay option then.
Comment by Paul Seropian (paranoos) - Sunday, 21 February 2010, 02:11 GMT
:) works like a charm, Thomas. Thanks.

Loading...