initfs: Unmount ro and rw
Perform the minimal change to unmount /ro and /rw, which were
/run/initramfs/ro and /run/initramfs/rw and protected by systemd
from being unmounted.
This is the minimal change to support the behavior of systemd as
of August 23, 2023 (top of tree and v254.1).
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
index a180fa0..8e184a8 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
@@ -20,11 +20,13 @@
# Move /oldroot/run to /mnt in case it has the underlying rofs loop mounted.
# Ordered before /oldroot the overlay is unmounted before the loop mount
+# Also unmount /ro and /rw as /./ro and /./rw to unmount last
mkdir -p /mnt
mount --move /oldroot/run /mnt
set -x
-awk '/oldroot|mnt/ { print $2 }' < /proc/mounts | sort -r | while IFS= read -r f
+awk '/oldroot|mnt/ { print $2 } / .r[ow] / { print "/." $2 }' < /proc/mounts |
+ sort -r | while IFS= read -r f
do
umount "$f"
done