From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH] meta: Explicitly undo wic mounts
Date: Thu, 2 Jun 2022 15:05:52 +0200 [thread overview]
Message-ID: <20220602130552.27997-1-ubely@ilbers.de> (raw)
Creating wic image requires some host paths be equal to buildchroot paths.
Thus, we have a situation, when ${STAGING_DIR} that is equal to ${TMPDIR}
needs to be bind-mounted under it subdirectory so that path to the image
rootfs under buildchroot was the same as path outside.
E.g. we have the following mountpoint during wic imaging:
${TMPDIR}/work/<distro-arch>/buildchroot-target/1.0-r0/rootfs/${TMPDIR}
In this situation, an issue was caught under some chroots, that final
event-based unmounting didsn't completely unmount everything. This was
reproduced, at least, under buster host and bullseye chroot.
This fix solved the problem by explicit unmounting wic-related mounts.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
meta/classes/imagetypes_wic.bbclass | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 61a74d4a..ef8b3b5f 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -146,6 +146,7 @@ IMAGE_CMD_wic() {
wic_do_mounts
generate_wic_image
check_for_wic_warnings
+ wic_undo_mounts
}
wic_do_mounts[vardepsexclude] += "BITBAKEDIR"
@@ -164,6 +165,20 @@ wic_do_mounts() {
EOSUDO
}
+wic_undo_mounts[vardepsexclude] += "BITBAKEDIR"
+wic_undo_mounts() {
+ sudo -s <<'EOSUDO'
+ ( flock 9
+ set -e
+ for dir in ${BITBAKEDIR} ${SCRIPTSDIR} ${STAGING_DIR} ${BBLAYERS}; do
+ if mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1; then
+ umount ${BUILDCHROOT_DIR}/$dir
+ fi
+ done
+ ) 9>${MOUNT_LOCKFILE}
+EOSUDO
+}
+
generate_wic_image[vardepsexclude] += "WKS_FULL_PATH BITBAKEDIR TOPDIR"
generate_wic_image() {
export FAKEROOTCMD=${FAKEROOTCMD}
--
2.20.1
reply other threads:[~2022-06-02 13:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220602130552.27997-1-ubely@ilbers.de \
--to=ubely@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox