Message ID | 20241024101004.214465-1-amikan@ilbers.de |
---|---|
State | Accepted, archived |
Headers | show |
Series | [v2] initramfs: Avoid hanging mounts on failed update-initramfs | expand |
On Thu, 2024-10-24 at 13:10 +0300, Anton Mikanovich wrote: > If update-initramfs fails during do_generate_initramfs task execution > there will be mounts left behind: > > > E: /usr/share/initramfs-tools/hooks/isar-example failed with return > > 1. > > update-initramfs: failed for /boot/initrd.img-6.1.0-26-amd64 with > > 1. > > WARNING: exit code 1 from a shell command. > ERROR: Task (mc:qemuamd64-bookworm:isar/meta-isar/recipes- > initramfs/images/isar-initramfs.bb:do_generate_initramfs) failed with > exit code '1' > NOTE: Tasks Summary: Attempted 38 tasks of which 27 didn't need to be > rerun and 1 failed. > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/isar-apt left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/sys left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/proc left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev/pts left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev/shm left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev left mounted, unmounting... > > Protect mounting with a trap for cleanup in case of failure. > > Signed-off-by: Anton Mikanovich <amikan@ilbers.de> > --- > meta/classes/initramfs.bbclass | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/meta/classes/initramfs.bbclass > b/meta/classes/initramfs.bbclass > index 42013356..0197a60b 100644 > --- a/meta/classes/initramfs.bbclass > +++ b/meta/classes/initramfs.bbclass > @@ -35,6 +35,10 @@ do_generate_initramfs[sstate-inputdirs] = > "${DEPLOYDIR}" > do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" > do_generate_initramfs() { > rootfs_do_mounts > + > + trap 'exit 1' INT HUP QUIT TERM ALRM USR1 > + trap 'rootfs_do_umounts' EXIT > + > rootfs_do_qemu > > sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\ > -- > 2.34.1 > Since patch v2 is technically a v1 with updated commit message, already well-tested in CI, we would like to merge it soon (e.g. 2024-10-), if there are no objections.
On Thu, 2024-10-24 at 13:40 +0300, Uladzimir Bely wrote: > Since patch v2 is technically a v1 with updated commit message, > already > well-tested in CI, we would like to merge it soon (e.g. 2024-10-), if > there are no objections. Sorry, 2024-10-25 (tomorrow) was meant.
On Thu, 2024-10-24 at 13:10 +0300, Anton Mikanovich wrote: > If update-initramfs fails during do_generate_initramfs task execution > there will be mounts left behind: > > > E: /usr/share/initramfs-tools/hooks/isar-example failed with return > > 1. > > update-initramfs: failed for /boot/initrd.img-6.1.0-26-amd64 with > > 1. > > WARNING: exit code 1 from a shell command. > ERROR: Task (mc:qemuamd64-bookworm:isar/meta-isar/recipes- > initramfs/images/isar-initramfs.bb:do_generate_initramfs) failed with > exit code '1' > NOTE: Tasks Summary: Attempted 38 tasks of which 27 didn't need to be > rerun and 1 failed. > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/isar-apt left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/sys left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/proc left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev/pts left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev/shm left mounted, unmounting... > WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs- > qemuamd64/1.0-r0/rootfs/dev left mounted, unmounting... > > Protect mounting with a trap for cleanup in case of failure. > > Signed-off-by: Anton Mikanovich <amikan@ilbers.de> > --- > meta/classes/initramfs.bbclass | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/meta/classes/initramfs.bbclass > b/meta/classes/initramfs.bbclass > index 42013356..0197a60b 100644 > --- a/meta/classes/initramfs.bbclass > +++ b/meta/classes/initramfs.bbclass > @@ -35,6 +35,10 @@ do_generate_initramfs[sstate-inputdirs] = > "${DEPLOYDIR}" > do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" > do_generate_initramfs() { > rootfs_do_mounts > + > + trap 'exit 1' INT HUP QUIT TERM ALRM USR1 > + trap 'rootfs_do_umounts' EXIT > + > rootfs_do_qemu > > sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\ > -- > 2.34.1 > Applied to next.
diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass index 42013356..0197a60b 100644 --- a/meta/classes/initramfs.bbclass +++ b/meta/classes/initramfs.bbclass @@ -35,6 +35,10 @@ do_generate_initramfs[sstate-inputdirs] = "${DEPLOYDIR}" do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" do_generate_initramfs() { rootfs_do_mounts + + trap 'exit 1' INT HUP QUIT TERM ALRM USR1 + trap 'rootfs_do_umounts' EXIT + rootfs_do_qemu sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\
If update-initramfs fails during do_generate_initramfs task execution there will be mounts left behind: | E: /usr/share/initramfs-tools/hooks/isar-example failed with return 1. | update-initramfs: failed for /boot/initrd.img-6.1.0-26-amd64 with 1. | WARNING: exit code 1 from a shell command. ERROR: Task (mc:qemuamd64-bookworm:isar/meta-isar/recipes-initramfs/images/isar-initramfs.bb:do_generate_initramfs) failed with exit code '1' NOTE: Tasks Summary: Attempted 38 tasks of which 27 didn't need to be rerun and 1 failed. WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/isar-apt left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/sys left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/proc left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev/pts left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev/shm left mounted, unmounting... WARNING: build/tmp/work/debian-bookworm-amd64/isar-initramfs-qemuamd64/1.0-r0/rootfs/dev left mounted, unmounting... Protect mounting with a trap for cleanup in case of failure. Signed-off-by: Anton Mikanovich <amikan@ilbers.de> --- meta/classes/initramfs.bbclass | 4 ++++ 1 file changed, 4 insertions(+)