Bug#1008911: initscripts: /run often mounted nodev, "/run/rootdev" likely to fail
Mark Hindley
mark at hindley.org.uk
Wed Feb 12 09:18:56 GMT 2025
Control: retitle -1 move last-resort fallback /run/rootdev to /dev as /run maybe mounted read-only or nodev
Control: tags -1 patch
Thanks both for clarifying this. Could you review and test the attached patch,
please?
As a followup, we should be able to add nodev as noted as TODO:
mount-functions.sh:511. But I think that should not be done this close to
freeze.
Mark
commit 5ae2c4c1c9ba68fe820755fef6f10f58989f2772
Author: Mark Hindley <mark at hindley.org.uk>
Date: Wed Feb 12 09:05:12 2025 +0000
Create last-resort root device in /dev: /run may be nodev or read-only.
Closes: #1008911
diff --git a/debian/src/initscripts/etc/init.d/checkroot.sh b/debian/src/initscripts/etc/init.d/checkroot.sh
index f34b671d..84378a53 100755
--- a/debian/src/initscripts/etc/init.d/checkroot.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot.sh
@@ -100,7 +100,7 @@ do_start () {
#
# Does the root device in /etc/fstab match with the actual device ?
# If not we try to use the /dev/root alias device, and if that
- # fails we create a temporary node in /run.
+ # fails we create a temporary node in /dev.
#
# Do this only on Linux. Neither kFreeBSD nor Hurd have
# /dev/root and the device ids used here are specific to
@@ -117,11 +117,11 @@ do_start () {
rootdev=/dev/root
else
if \
- rm -f /run/rootdev \
- && mknod -m 600 /run/rootdev b ${rdev%:*} ${rdev#*:} \
- && [ -e /run/rootdev ]
+ rm -f /dev/rootdev \
+ && mknod -m 600 /dev/rootdev b ${rdev%:*} ${rdev#*:} \
+ && [ -b /dev/rootdev ]
then
- rootdev=/run/rootdev
+ rootdev=/dev/rootdev
else
rootfatal=yes
fi
@@ -136,7 +136,7 @@ do_start () {
then
log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect
or there is no entry for the root filesystem listed in /etc/fstab.
-The system is also unable to create a temporary node in /run.
+The system is also unable to create a temporary node in /dev.
This means you have to fix the problem manually."
log_warning_msg "A maintenance shell will now be started.
CONTROL-D will terminate this shell and restart the system."
@@ -336,9 +336,9 @@ but requested that the system be restarted."
fi
#
- # Remove /run/rootdev if we created it.
+ # Remove /dev/rootdev if we created it.
#
- rm -f /run/rootdev
+ rm -f /dev/rootdev
# Update mount options for mounts created in early boot
# S01mountkernfs.sh
More information about the Debian-init-diversity
mailing list