public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'MOESSBAUER, Felix' via isar-users" <isar-users@googlegroups.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"Kiszka, Jan" <jan.kiszka@siemens.com>
Subject: Re: [PATCH] initramfs: Add missing umounts after generation
Date: Tue, 1 Oct 2024 07:38:16 +0000	[thread overview]
Message-ID: <855415c409c8a24b672ed64dba8f3227edf23355.camel@siemens.com> (raw)
In-Reply-To: <1646de44-c244-43b3-ad57-b3bf702608b0@siemens.com>

On Mon, 2024-09-30 at 21:42 +0200, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Failing to unmount what was mounted via rootfs_do_mounts can cause
> troubles on rebuilds.

Why is that not caught by the cleanup handler in [1]?
I'm just wondering as the mounting and unmounting does not happen in
the same task, hence we will run into problems on partial rebuilds.

[1]https://github.com/ilbers/isar/blob/51462e82e4a108c9c94ba4099465f5a19a7125a6/meta/classes/isar-events.bbclass#L53

Felix

> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  meta/classes/image.bbclass     | 21 ++-------------------
>  meta/classes/initramfs.bbclass |  2 ++
>  meta/classes/rootfs.bbclass    | 25 +++++++++++++++++++++++++
>  3 files changed, 29 insertions(+), 19 deletions(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index c29d9e26..1414a3ee 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -393,6 +393,8 @@ python do_deploy() {
>  addtask deploy before do_build after do_image
>  
>  do_rootfs_finalize() {
> +    rootfs_do_umounts
> +
>      sudo -s <<'EOSUDO'
>          set -e
>  
> @@ -406,25 +408,6 @@ do_rootfs_finalize() {
>                  -maxdepth 1 -name 'qemu-*-static' -type f -delete
>          fi
>  
> -        mountpoint -q '${ROOTFSDIR}/isar-apt' && \
> -            umount '${ROOTFSDIR}/isar-apt' && \
> -            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt
> -
> -        mountpoint -q '${ROOTFSDIR}/base-apt' && \
> -            umount '${ROOTFSDIR}/base-apt' && \
> -            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
> -
> -        mountpoint -q '${ROOTFSDIR}/dev/pts' && \
> -            umount '${ROOTFSDIR}/dev/pts'
> -        mountpoint -q '${ROOTFSDIR}/dev/shm' && \
> -            umount '${ROOTFSDIR}/dev/shm'
> -        mountpoint -q '${ROOTFSDIR}/dev' && \
> -            umount '${ROOTFSDIR}/dev'
> -        mountpoint -q '${ROOTFSDIR}/proc' && \
> -            umount '${ROOTFSDIR}/proc'
> -        mountpoint -q '${ROOTFSDIR}/sys' && \
> -            umount '${ROOTFSDIR}/sys'
> -
>          if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
>              mv "${ROOTFSDIR}/etc/apt/sources-list" \
>                  "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
> diff --git a/meta/classes/initramfs.bbclass
> b/meta/classes/initramfs.bbclass
> index 6886b95a..42013356 100644
> --- a/meta/classes/initramfs.bbclass
> +++ b/meta/classes/initramfs.bbclass
> @@ -45,6 +45,8 @@ do_generate_initramfs() {
>            update-initramfs -u -v ;  \
>          fi'
>  
> +    rootfs_do_umounts
> +
>      if [ ! -e "${INITRAMFS_ROOTFS}/initrd.img" ]; then
>          bberror "No initramfs was found after generation!"
>      fi
> diff --git a/meta/classes/rootfs.bbclass
> b/meta/classes/rootfs.bbclass
> index f0abd795..0b4ea061 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -65,6 +65,31 @@ rootfs_do_mounts() {
>  EOSUDO
>  }
>  
> +rootfs_do_umounts() {
> +    sudo -s <<'EOSUDO'
> +        set -e
> +        mountpoint -q '${ROOTFSDIR}/isar-apt' && \
> +            umount '${ROOTFSDIR}/isar-apt' && \
> +            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt
> +
> +        mountpoint -q '${ROOTFSDIR}/base-apt' && \
> +            umount '${ROOTFSDIR}/base-apt' && \
> +            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
> +
> +        mountpoint -q '${ROOTFSDIR}/dev/pts' && \
> +            umount '${ROOTFSDIR}/dev/pts'
> +        mountpoint -q '${ROOTFSDIR}/dev/shm' && \
> +            umount '${ROOTFSDIR}/dev/shm'
> +        mountpoint -q '${ROOTFSDIR}/dev' && \
> +            umount '${ROOTFSDIR}/dev'
> +        mountpoint -q '${ROOTFSDIR}/proc' && \
> +            umount '${ROOTFSDIR}/proc'
> +        mountpoint -q '${ROOTFSDIR}/sys' && \
> +            umount '${ROOTFSDIR}/sys'
> +
> +EOSUDO
> +}
> +
>  rootfs_do_qemu() {
>      if [ '${@repr(d.getVar('ROOTFS_ARCH') ==
> d.getVar('HOST_ARCH'))}' = 'False' ]
>      then
> -- 
> 2.43.0
> 

-- 
Siemens AG, Technology
Linux Expert Center


-- 
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 on the web visit https://groups.google.com/d/msgid/isar-users/855415c409c8a24b672ed64dba8f3227edf23355.camel%40siemens.com.

  reply	other threads:[~2024-10-01  7:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 19:42 'Jan Kiszka' via isar-users
2024-10-01  7:38 ` 'MOESSBAUER, Felix' via isar-users [this message]
2024-10-01 10:04   ` 'Jan Kiszka' via isar-users
2024-10-02  8:31     ` 'Florian Bezdeka' via isar-users
2024-10-02 10:28       ` 'Jan Kiszka' via isar-users
2024-10-02 15:10         ` 'Florian Bezdeka' via isar-users
2024-10-03 16:15         ` Baurzhan Ismagulov
2024-10-04  7:47           ` 'Jan Kiszka' via isar-users

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=855415c409c8a24b672ed64dba8f3227edf23355.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=jan.kiszka@siemens.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