summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-10 17:16:10 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-10 17:18:04 +0200
commit058bf4ccc407e80c943715bec7f73d71fba28c3c (patch)
treec3c11e2b81d2d351d6d9f30ac0f7d4cd49f29f5a /nixos
parentbd19f65ebf3ec20d4c303e3cfb541d0e0b25b9d2 (diff)
downloadnixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar.gz
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar.bz2
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar.lz
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar.xz
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.tar.zst
nixlib-058bf4ccc407e80c943715bec7f73d71fba28c3c.zip
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
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh8
-rw-r--r--nixos/modules/system/boot/stage-1.nix3
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;
 
   };