public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: Anton Mikanovich <amikan@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [PATCH v2] initramfs: Avoid hanging mounts on failed update-initramfs
Date: Thu, 24 Oct 2024 13:40:54 +0300	[thread overview]
Message-ID: <b93c0e5ae4d4c71a0e380b6db7a2e50e2201d85a.camel@ilbers.de> (raw)
In-Reply-To: <20241024101004.214465-1-amikan@ilbers.de>

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.

  reply	other threads:[~2024-10-24 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 10:10 Anton Mikanovich
2024-10-24 10:40 ` Uladzimir Bely [this message]
2024-10-24 10:42   ` Uladzimir Bely
2024-10-25 13:58 ` Uladzimir Bely

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=b93c0e5ae4d4c71a0e380b6db7a2e50e2201d85a.camel@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=amikan@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