From 861c806b25392767d1069437352e7a7fd3fa1da4 Mon Sep 17 00:00:00 2001 From: Arseny Maslennikov Date: Fri, 6 Sep 2024 14:10:05 +0300 Subject: [PATCH startup.git] halt: treat /usr as / To: devel@lists.altlinux.org If /usr is its own mountpoint, we have to treat it as one of the last remaining filesystems before the system is halted, since it e. g. hosts /usr/sbin/reboot. Link: https://bugzilla.altlinux.org/51235 Link: https://altlinux.org/Usrmerge Signed-off-by: Arseny Maslennikov --- startup/rc.d/init.d/halt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/startup/rc.d/init.d/halt b/startup/rc.d/init.d/halt index 1464d08..eb9d333 100755 --- a/startup/rc.d/init.d/halt +++ b/startup/rc.d/init.d/halt @@ -160,7 +160,7 @@ UnmountFilesystems 3 5 \ # Unmount all the rest. UnmountFilesystems 3 5 \ - '$2 != "/" && $2 !~ /^\/(dev|proc|sys)(\/.*)?$/ && $1 !~ /^none$/ {print $2}' \ + '$2 != "/" && $2 != "/usr" && $2 !~ /^\/(dev|proc|sys)(\/.*)?$/ && $1 !~ /^none$/ {print $2}' \ 'Unmounting filesystem' \ 'Unmounting filesystem (retry)' @@ -188,6 +188,9 @@ fi # Unmount and remount read-only anything that's left mounted. action 'Remounting remaining filesystems (if any) read-only:' \ umount -afnr -t noproc,nosysfs,notmpfs,nodevfs,nodevtmpfs,nousbfs,norpc_pipefs,nonfsd +if mountpoint -q /usr; then + action 'Remounting usr filesystem read-only:' mount -n -o remount,ro /usr +fi action 'Remounting root filesystem read-only:' mount -n -o remount,ro / # See if this is a powerfail situation. -- 2.45.2