aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-04-23 20:22:23 +0200
committerTom Gundersen <teg@jklm.no>2011-04-23 21:44:05 +0200
commit5fcb5afeb15d0617407abfd5b0827153b632d7c4 (patch)
tree7bd0c6233826e4012206df3e38ab5be9c8650b6e /rc.sysinit
parenteda191cf78365cc3d15c0b8c0d8f571c69cd059e (diff)
downloadinitscripts-5fcb5afeb15d0617407abfd5b0827153b632d7c4.tar.xz
remount root very early
This remounts root read-only as early as possible. In FS#23845 we saw an example of what might happen if we boot with root mounted rw and something manages to opens a file read-write on root before we remount read-only. Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit7
1 files changed, 5 insertions, 2 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 497caae..e102beb 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -34,6 +34,11 @@ fi
/bin/mountpoint -q /dev/shm || /bin/mount /devshm &> /dev/null \
|| /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
+# remount root ro to allow for fsck later on, we remount now to
+# make sure nothing can open files rw on root which would block a remount
+/bin/findmnt / --options ro &>/dev/null || \
+status "Mounting Root Read-Only" /bin/mount -n -o remount,ro /
+
# start up our mini logger until syslog takes over
/sbin/minilogd
/sbin/bootlogd -p /run/bootlogd.pid
@@ -216,8 +221,6 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
fi
fi
-status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
-
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs"
if [[ -x /sbin/fsck ]]; then