FS#35529 - [mkinitcpio] root=/dev/nfs makes arch wait 10 seconds before booting
Attached to Project:
Arch Linux
Opened by Antonio (kokoko3k) - Wednesday, 29 May 2013, 08:03 GMT
Last edited by Jelle van der Waa (jelly) - Monday, 18 September 2023, 17:44 GMT
Opened by Antonio (kokoko3k) - Wednesday, 29 May 2013, 08:03 GMT
Last edited by Jelle van der Waa (jelly) - Monday, 18 September 2023, 17:44 GMT
|
Details
I've a pxe system that mounts "/" over nfs, and i noticed
that the 10 seconds the system waits for /dev/nfs always
timeout, on every boot.
but after that, the system boots fine and the nfs mounts are available. changing rootdelay kernel parameter to a lower value (even just 1 second) , makes the system boots faster and fine; I went deeper into this, The problem is (seems to be) that the init function: poll_device() in /usr/lib/initcpio/init_functions, waits for the device /dev/nfs (specified in the kernel command line) to be available. But /dev/nfs will never show up because, as stated here: https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt " root=/dev/nfs This is necessary to enable the pseudo-NFS-device. Note that it's not a real device but just a synonym to tell the kernel to use NFS instead of a real device. " To make the long story short: - the kernel needs root=/dev/nfs in order to boot from nfs - arch init waits for /dev/nfs - /dev/nfs does not appear because is not meant to be a real device |
This task depends upon
Closed by Jelle van der Waa (jelly)
Monday, 18 September 2023, 17:44 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/issues/202
Monday, 18 September 2023, 17:44 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/m kinitcpio/mkinitcpio/issues/202
waiting 10 seconds for device for /dev/nfs
This is what i tried:
#-------------------------------------------------------
LABEL archlinux
MENU LABEL ArchLinux
MENU PASSWD koko
kernel /archlinux/boot/vmlinuz-linux
append initrd=archlinux/boot/initramfs-linux-fallback.img rootfstype=nfs nfsroot=192.168.117.244:/home/tftproot/archlinux/,rsize=16384,wsize=16384 ip=::::::dhcp init=/usr/lib/systemd/systemd
#-------------------------------------------------------
Do you know if there is a way to avoid that useless delay without forcing arbitrary values with rootdelay?
I have traced the flow below and it seems the solution is to either add an exception for '/dev/nfs' in 'resolve_device' or adjust the net hook not to set root. I'm not sure what else uses root so in my opinion the exception is more reasonable. I have tested and verified it working with the resolve_device exception '[ "$device" = "/dev/nfs" ] && return 0'.
I have another edit for the net hook i'd like to make but not sure where to make it, is 'https://git.archlinux.org/svntogit/packages.git/tree/trunk/initcpio-install-net?h=packages/mkinitcpio-nfs-utils' correct? I'll submit this one as well if you can point me in the correct location.
/usr/lib/initcpio/hooks/net -> sets root=/dev/nfs
/usr/lib/initcpio/init -> resolves this device 'rootdev=$(resolve_device "$root") && root=$rootdev'
/usr/lib/initcpio/init_functions(resolve_device) -> calls 'poll_device "$device" "$rootdelay"'
/usr/lib/initcpio/init_functions(poll_device /dev/nfs "") -> tests for the block device '[ -b "$device" ]', otherwise sleeps for $2 or 10 seconds and checks for the device again as it's return value
Sorry about the duplicate post, refreshed the page and it reposted. I'll watch out for that in the future.