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
This commit is contained in:
Eelco Dolstra 2014-10-10 17:16:10 +02:00
parent bd19f65ebf
commit 058bf4ccc4
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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;
};