From a3e8f18d60faf237a3aec320658b535c4bc41c7b Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 17 May 2014 15:58:42 +0000 Subject: [PATCH] - remount /proc and /sys with options from fstab before init --- dracut.spec | 4 +++- proc_sys_remount.patch | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 proc_sys_remount.patch diff --git a/dracut.spec b/dracut.spec index bdc6f12..2941723 100644 --- a/dracut.spec +++ b/dracut.spec @@ -16,7 +16,8 @@ Patch5: systemd-paths.patch Patch6: prelink-libs.patch Patch7: config.patch Patch8: xz_compressor.patch -Patch9: misc_fixes.patch +Patch9: proc_sys_remount.patch +Patch10: misc_fixes.patch Patch100: git.patch URL: https://dracut.wiki.kernel.org/ BuildRequires: asciidoc @@ -201,6 +202,7 @@ Bashowe dopełnianie składni dla polecenia dracut. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %patch100 -p1 %{__sed} -i -e 's,@lib@,%{_lib},g' modules.d/50plymouth/module-setup.sh diff --git a/proc_sys_remount.patch b/proc_sys_remount.patch new file mode 100644 index 0000000..496f20b --- /dev/null +++ b/proc_sys_remount.patch @@ -0,0 +1,30 @@ +diff -urN dracut-037.orig/modules.d/99base/init.sh dracut-037/modules.d/99base/init.sh +--- dracut-037.orig/modules.d/99base/init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut-037/modules.d/99base/init.sh 2014-05-17 15:55:22.273000000 +0000 +@@ -258,6 +258,26 @@ + source_hook cleanup + + # By the time we get here, the root filesystem should be mounted. ++ ++# Remount /proc and /sys with options from $NEWROOT/etc/fstab, ++# keep defaults just in case. ++procopts="nosuid,noexec,nodev," ++sysopts="nosuid,noexec,nodev," ++if [ -f "$NEWROOT/etc/fstab" ] \ ++ && ! [ -L "$NEWROOT/etc/fstab" ]; then ++ while read dev mp fs opts dump fsck; do ++ # skip comments ++ [ "${dev%%#*}" != "$dev" ] && continue ++ if [ "$mp" = "/proc" ]; then ++ procopts=$opts ++ elif [ "$mp" = "/sys" ]; then ++ sysopts=$opts ++ fi ++ done < "$NEWROOT/etc/fstab" ++fi ++mount -o remount,$procopts /proc 2>&1 ++mount -o remount,$sysopts /sys 2>&1 ++ + # Try to find init. + for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do + [ -n "$i" ] || continue -- 2.46.0