From 058bf4ccc407e80c943715bec7f73d71fba28c3c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Oct 2014 17:16:10 +0200 Subject: [PATCH] Create a udev rule for /dev/root In the installation CD, this ensures that systemd will see a proper udev node for /dev/root. Fixes #4399. Borrowed from http://lists.freedesktop.org/archives/systemd-devel/2014-July/020988.html --- nixos/modules/system/boot/stage-1-init.sh | 8 ++++++++ nixos/modules/system/boot/stage-1.nix | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index f14f105ef239..5a9beeeafa1d 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -368,6 +368,14 @@ exec 3>&- @postMountCommands@ +# Emit a udev rule for /dev/root to prevent systemd from complaining. +eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true) +if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then + mkdir -p /run/udev/rules.d + echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > /run/udev/rules.d/61-dev-root-link.rules +fi + + # Stop udevd. udevadm control --exit || true diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 1ec11e70e845..6b09559876ca 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -346,9 +346,6 @@ in (isYes "BLK_DEV_INITRD") ]; - # Prevent systemd from waiting for the /dev/root symlink. - systemd.units."dev-root.device".text = ""; - boot.initrd.supportedFilesystems = map (fs: fs.fsType) fileSystems; };