* [PATCH] meta: Explicitly undo wic mounts
@ 2022-06-02 13:05 Uladzimir Bely
0 siblings, 0 replies; only message in thread
From: Uladzimir Bely @ 2022-06-02 13:05 UTC (permalink / raw)
To: isar-users
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-02 13:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 13:05 [PATCH] meta: Explicitly undo wic mounts Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox