From 4c73ae45859d784e8123f372068ac96e635d841f Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 16 Jun 2018 02:15:00 -0400 Subject: Move unknown mountpoints before booting If there are mountpoints outside of /root, which `run-init` does not have in its whitelist, then `run-init` will refuse to boot and will crash the kernel instead (process 1 will exit). --- src/initrd/btrfs-create.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/initrd') diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh index 567ad97..f47dfaf 100644 --- a/src/initrd/btrfs-create.sh +++ b/src/initrd/btrfs-create.sh @@ -71,6 +71,19 @@ init_samizdat() initialize_root_filesystem || return } +movemounts() +{ + # Move mounted filesystems to the future root filesystem + while read dev mp rest; do + case "$mp" in + /root/*|/root|/|/proc|/dev|/dev/pts|/sys|/run) continue ;; + *) target=/root/$mp ;; + esac + mkdir -p "$target" + mount -n -o move "$mp" "$target" + done