From ac8a2ae57700e65e11396027993aab17b7187b51 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 10 Jan 2010 19:00:29 +0000 Subject: [PATCH] * Use the LVM udev rules in stage 1. This makes /dev/disk/by-{label,uuid} paths available for LVM volumes. svn path=/nixos/trunk/; revision=19334 --- modules/system/boot/stage-1-init.sh | 9 +++++---- modules/system/boot/stage-1.nix | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 2d95042d109..76c2be8a048 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -114,14 +114,15 @@ echo "running udev..." export UDEV_CONFIG_FILE=@udevConf@ mkdir -p /dev/.udev # !!! bug in udev? udevd --daemon +udevadm control --env=STARTUP=1 udevadm trigger +udevadm control --env=STARTUP= udevadm settle echo "starting device mapper and LVM..." -dmsetup mknodes -lvm vgscan --ignorelockingfailure -lvm vgchange -ay --ignorelockingfailure - +lvm vgscan +lvm vgchange -ay + if test -n "$debug1devices"; then fail; fi diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index 137eaa9e379..504b1080bb7 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -133,7 +133,7 @@ let cp -pd ${pkgs.e2fsprogs}/lib/lib*.so.* $out/lib - # Copy dmsetup and lvm, if we need it. + # Copy dmsetup and lvm. cp ${pkgs.lvm2}/sbin/dmsetup $out/bin/dmsetup cp ${pkgs.lvm2}/sbin/lvm $out/bin/lvm cp ${pkgs.lvm2}/lib/libdevmapper.so.*.* $out/lib @@ -211,6 +211,7 @@ let cp ${pkgs.udev}/libexec/rules.d/60-cdrom_id.rules $out/ cp ${pkgs.udev}/libexec/rules.d/60-persistent-storage.rules $out/ cp ${pkgs.udev}/libexec/rules.d/80-drivers.rules $out/ + cp ${pkgs.lvm2}/lib/udev/rules.d/*.rules $out/ for i in $out/*.rules; do substituteInPlace $i \ @@ -221,7 +222,9 @@ let --replace vol_id ${extraUtils}/bin/vol_id \ --replace cdrom_id ${extraUtils}/bin/cdrom_id \ --replace /sbin/blkid ${extraUtils}/bin/blkid \ - --replace /sbin/modprobe ${extraUtils}/bin/modprobe + --replace /sbin/modprobe ${extraUtils}/bin/modprobe \ + --replace '$env{DM_SBIN_PATH}/blkid' ${extraUtils}/bin/blkid \ + --replace 'ENV{DM_SBIN_PATH}="/sbin"' 'ENV{DM_SBIN_PATH}="${extraUtils}/bin"' done # Remove rule preventing creation of a by-label symlink