summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJustin Bronder <jsbronder@cold-front.org>2022-02-10 15:23:22 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-12 17:05:35 +0000
commit2040c70fcccb3bb89b9196f1676bc7ff5ea5a876 (patch)
tree7e584efe2a6f218c9617c5fb1974a120b97f0056 /meta
parent602bec0060de94fa0ebb4e3b76bb3c3515a7a4a4 (diff)
downloadpoky-2040c70fcccb3bb89b9196f1676bc7ff5ea5a876.tar.gz
initramfs-framework: unmount automounts before switch_root
If mounts are left lingering, then after we switch_root, attempts to modify the block devices will result in an EBUSY with no way to unmount them. As we're about to switch_root anyways, there isn't much use to keep anything mounted unless it has the new rootfs. (From OE-Core rev: 4dc7af6d25597ea10ea43e76c7c3d7251462c0e5) Signed-off-by: Justin Bronder <jsbronder@cold-front.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish12
1 files changed, 12 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 717383ebac..f08a920867 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -12,6 +12,18 @@ finish_run() {
12 fatal "ERROR: There's no '/dev' on rootfs." 12 fatal "ERROR: There's no '/dev' on rootfs."
13 fi 13 fi
14 14
15 # Unmount anything that was automounted by busybox via mdev-mount.sh.
16 # We're about to switch_root, and leaving anything mounted will prevent
17 # the next rootfs from modifying the block device. Ignore ROOT_DISK,
18 # if it was set by setup-live, because it'll be mounted over loopback
19 # to ROOTFS_DIR.
20 local dev
21 for dev in /run/media/*; do
22 if mountpoint -q "${dev}" && [ "${dev##*/}" != "${ROOT_DISK}" ]; then
23 umount -f "${dev}" || debug "Failed to unmount ${dev}"
24 fi
25 done
26
15 info "Switching root to '$ROOTFS_DIR'..." 27 info "Switching root to '$ROOTFS_DIR'..."
16 28
17 debug "Moving /dev, /proc and /sys onto rootfs..." 29 debug "Moving /dev, /proc and /sys onto rootfs..."