Blob Blame History Raw
From 8fb06a05624d8aaa067b61b70ecbbbd90fc0f88e Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 30 Nov 2015 11:27:03 +0100
Subject: [PATCH] shutdown: guard against read-only /run

remount the switch rooted /run writeable again.

(cherry picked from commit 54e09dfb72b557ac8ccd48f5d37089287d272ec7)
---
 modules.d/99shutdown/module-setup.sh | 2 +-
 modules.d/99shutdown/shutdown.sh     | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh
index 5361936e..bdb33733 100755
--- a/modules.d/99shutdown/module-setup.sh
+++ b/modules.d/99shutdown/module-setup.sh
@@ -13,7 +13,7 @@ depends() {
 
 install() {
     local _d
-    inst_multiple umount poweroff reboot halt losetup
+    inst_multiple umount poweroff reboot halt losetup stat
     inst_multiple -o kexec
     inst "$moddir/shutdown.sh" "$prefix/shutdown"
     [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 1daf2ca3..bcb191bc 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -14,6 +14,10 @@ export TERM=linux
 export PATH=/usr/sbin:/usr/bin:/sbin:/bin
 . /lib/dracut-lib.sh
 
+if [ "$(stat -c '%T' -f /)" = "tmpfs" ]; then
+    mount -o remount,rw /
+fi
+
 mkdir /oldsys
 for i in sys proc run dev; do
     mkdir /oldsys/$i