public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs
@ 2024-10-24 10:10 Anton Mikanovich
  2024-10-24 10:40 ` Uladzimir Bely
  2024-10-25 13:58 ` Uladzimir Bely
  0 siblings, 2 replies; 4+ messages in thread
From: Anton Mikanovich @ 2024-10-24 10:10 UTC (permalink / raw)
  To: isar-users; +Cc: Anton Mikanovich

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

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241024101004.214465-1-amikan%40ilbers.de.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs
  2024-10-24 10:10 [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs Anton Mikanovich
@ 2024-10-24 10:40 ` Uladzimir Bely
  2024-10-24 10:42   ` Uladzimir Bely
  2024-10-25 13:58 ` Uladzimir Bely
  1 sibling, 1 reply; 4+ messages in thread
From: Uladzimir Bely @ 2024-10-24 10:40 UTC (permalink / raw)
  To: Anton Mikanovich, isar-users

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.

-- 
Best regards,
Uladzimir.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/b93c0e5ae4d4c71a0e380b6db7a2e50e2201d85a.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs
  2024-10-24 10:40 ` Uladzimir Bely
@ 2024-10-24 10:42   ` Uladzimir Bely
  0 siblings, 0 replies; 4+ messages in thread
From: Uladzimir Bely @ 2024-10-24 10:42 UTC (permalink / raw)
  To: isar-users

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.


-- 
Best regards,
Uladzimir.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/3997e3985a050ae980884c775e84ff68eaf58ec6.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs
  2024-10-24 10:10 [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs Anton Mikanovich
  2024-10-24 10:40 ` Uladzimir Bely
@ 2024-10-25 13:58 ` Uladzimir Bely
  1 sibling, 0 replies; 4+ messages in thread
From: Uladzimir Bely @ 2024-10-25 13:58 UTC (permalink / raw)
  To: Anton Mikanovich, isar-users

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.

-- 
Best regards,
Uladzimir.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/3ea2565951efedfd51d097722b1dcf71453af2ad.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-25 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-24 10:10 [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs Anton Mikanovich
2024-10-24 10:40 ` Uladzimir Bely
2024-10-24 10:42   ` Uladzimir Bely
2024-10-25 13:58 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox