From 4f4c5299798f8cdd145900a86a2166a6742e4275 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 6 Apr 2012 14:20:43 +0000 Subject: [PATCH] Stage 1 improvements: * Load scsi_wait_scan after all other kernel modules to ensure that all SCSI device nodes have been created. * Increase the timeout for the appearance of the root device to 20 seconds. * Do a "udevadm settle" just after the root device has appeared to make sure that udev isn't accessing the device anymore (hopefully). On EC2 (Xen), I've seen fsck on the root fail randomly with "device in use" errors. svn path=/nixos/trunk/; revision=33650 --- modules/installer/cd-dvd/system-tarball-fuloong2f.nix | 5 ----- modules/installer/cd-dvd/system-tarball-sheevaplug.nix | 5 ----- modules/profiles/all-hardware.nix | 5 ----- modules/system/boot/kernel.nix | 3 +++ modules/system/boot/stage-1-init.sh | 8 +++++++- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix index a0b92369f65..618f5ea9627 100644 --- a/modules/installer/cd-dvd/system-tarball-fuloong2f.nix +++ b/modules/installer/cd-dvd/system-tarball-fuloong2f.nix @@ -119,11 +119,6 @@ in boot.kernelPackages = pkgs.linuxPackages_2_6_35; boot.kernelParams = [ "console=tty" ]; - boot.initrd.kernelModules = - [ # Wait for SCSI devices to appear. - "scsi_wait_scan" - ]; - boot.postBootCommands = '' mkdir -p /mnt diff --git a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix index c5f6de4c221..e49bcf3a66a 100644 --- a/modules/installer/cd-dvd/system-tarball-sheevaplug.nix +++ b/modules/installer/cd-dvd/system-tarball-sheevaplug.nix @@ -106,11 +106,6 @@ in [ "mvsdio" "mmc_block" "reiserfs" "ext3" "ums-cypress" "rtc_mv" "ext4" ]; - boot.initrd.kernelModules = - [ - "scsi_wait_scan" - ]; - boot.postBootCommands = '' mkdir -p /mnt diff --git a/modules/profiles/all-hardware.nix b/modules/profiles/all-hardware.nix index 359324dd13c..b5e25fffb42 100644 --- a/modules/profiles/all-hardware.nix +++ b/modules/profiles/all-hardware.nix @@ -46,11 +46,6 @@ "hid_apple" ]; - boot.initrd.kernelModules = - [ # Wait for SCSI devices to appear. - "scsi_wait_scan" - ]; - # Include lots of firmware. require = [ ../hardware/network/intel-4965agn.nix diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index ea5a300fbce..a7e37b0909f 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -160,6 +160,9 @@ let kernel = config.boot.kernelPackages.kernel; in # Misc. stuff. "pcips2" "serio" "atkbd" "xtkbd" + + # To wait for SCSI devices to appear. + "scsi_wait_scan" ]; boot.initrd.kernelModules = diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 8456e3dae15..7c98b35eba2 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -139,6 +139,8 @@ mkdir -p /dev/.mdadm udevd --daemon udevadm trigger --action=add udevadm settle || true +modprobe scsi_wait_scan || true +udevadm settle || true # XXX: Use case usb->lvm will still fail, usb->luks->lvm is covered @@ -298,7 +300,7 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do # that we don't properly recognise. if test -z "$pseudoDevice" -a ! -e $device; then echo -n "waiting for device $device to appear..." - for ((try = 0; try < 10; try++)); do + for ((try = 0; try < 20; try++)); do sleep 1 if test -e $device; then break; fi echo -n "." @@ -306,6 +308,10 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do echo fi + # Wait once more for the udev queue to empty, just in case it's + # doing something with $device right now. + udevadm settle || true + echo "mounting $device on $mountPoint..." mountFS "$device" "$mountPoint" "$options" "$fsType"