Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

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 Gerardo Exequiel Pozzi (djgera) - Friday, 27 September 2013, 01:15 GMT
Task Type Bug Report
Category Arch Projects
Status Assigned
Assigned To Dave Reisner (falconindy)
Giancarlo Razzolini (grazzolini)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


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:


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

Comment by Dave Reisner (falconindy) - Wednesday, 29 May 2013, 18:57 GMT
The fact that you cite using an initramfs means that the documentation you cite is irrelevant -- it coincides with the builtin kernel logic for mounting a remote device. Do you not use nfsroot= ?
Comment by Antonio (kokoko3k) - Thursday, 30 May 2013, 10:35 GMT
Even if you are right, that root=/dev/nfs is useless with an initramfs, i tried to remove root=/dev/nfs from the boot line, while still using nfsroot, but at boot the system still says:
waiting 10 seconds for device for /dev/nfs
This is what i tried:


LABEL archlinux
kernel /archlinux/boot/vmlinuz-linux
append initrd=archlinux/boot/initramfs-linux-fallback.img rootfstype=nfs nfsroot=,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?
Comment by Doug Newgard (Scimmia) - Monday, 06 July 2015, 05:10 GMT
ping falconindy...
Comment by Giancarlo Razzolini (grazzolini) - Thursday, 07 March 2019, 15:19 GMT
Does this issue still happen with recent kernels and mkinitcpio?
Comment by Dave Reisner (falconindy) - Thursday, 07 March 2019, 15:42 GMT
I would assume so, yes.
Comment by Glenn Tanner (glenntanner3) - Tuesday, 02 April 2019, 19:17 GMT
Yes this is still an issue.
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 '' 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
Comment by Giancarlo Razzolini (grazzolini) - Tuesday, 02 April 2019, 23:47 GMT
Hi, I'm considering merging the netconf hook that is now on [community] with the net hook on mkinitcpio. Also, I think nfs specific code should be on a separate hook. I don't like the idea of implementing an exception.
Comment by Glenn Tanner (glenntanner3) - Wednesday, 03 April 2019, 01:37 GMT
As a rule I try to avoid them as well, and while I cannot look up the citation at the moment, I believe the kernel recognizes when root=/dev/nfs indicating a remote root file system on an nfs share. Therefore it is proper for the net hook to set root=/dev/nfs in case the user does not set that kernel parameter. An attempt to mount root doesn't occur until after resolve_root, but even so it's not mounted to /dev/nfs. So it will never exist as a physical device.
Comment by Glenn Tanner (glenntanner3) - Wednesday, 03 April 2019, 16:26 GMT
Its possible that having the NET hook set root=/dev/nfs as a run_latehook might be acceptable. I'm in a case right now where I'm about to add a run_latehook function to preserve the /tmp/net-*.conf files to the host OS.
Sorry about the duplicate post, refreshed the page and it reposted. I'll watch out for that in the future.