From: Zhihang Wei <wzh@ilbers.de>
To: Badrikesh Prusty <badrikesh.prusty@siemens.com>,
isar-users@googlegroups.com
Cc: felix.moessbauer@siemens.com, jan.kiszka@siemens.com,
gokhan.cetin@siemens.com, alexander.heinisch@siemens.com
Subject: Re: [PATCH v7] image-postproc: gate systemd preset-all on masked unit state
Date: Mon, 15 Jun 2026 11:02:24 +0200 [thread overview]
Message-ID: <a4b691e5-6e24-4883-ab81-dfd3793df250@ilbers.de> (raw)
In-Reply-To: <20260429130240.23780-1-badrikesh.prusty@siemens.com>
Applied to next, thanks.
Zhihang
On 4/29/26 15:02, 'Badrikesh Prusty' via isar-users wrote:
> Skip systemd preset-all during image postprocessing if masked unit files
> are detected, to avoid non-fatal failures when presetting units that are
> already masked.
>
> Move execution fully inside a single chroot invocation for consistency
> and reduced overhead.
>
> Fixes: 72b88a12 ("classes/image-postproc: Enable systemd units based on systemd presets")
>
> Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
> ---
> meta/classes-recipe/rootfs.bbclass | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
> index 8b502a50..d250690f 100644
> --- a/meta/classes-recipe/rootfs.bbclass
> +++ b/meta/classes-recipe/rootfs.bbclass
> @@ -569,13 +569,14 @@ EOSUDO
>
> ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'populate-systemd-preset', 'image_postprocess_populate_systemd_preset', '', d)}"
> image_postprocess_populate_systemd_preset() {
> - SYSTEMD_INSTALLED=$(sudo chroot '${ROOTFSDIR}' dpkg-query \
> - --showformat='${db:Status-Status}' \
> - --show systemd || echo "" )
> + sudo chroot "${ROOTFSDIR}" /bin/sh <<'EOSH'
> + SYSTEMD_INSTALLED=$(dpkg-query --showformat='${db:Status-Status}' --show systemd 2>/dev/null)
>
> - if (test "$SYSTEMD_INSTALLED" = "installed"); then
> - sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
> - fi
> + if [ "${SYSTEMD_INSTALLED}" = "installed" ]; then
> + systemctl list-unit-files --state=masked --no-legend | grep -q '^' \
> + || systemctl preset-all --preset-mode="enable-only"
> + fi
> +EOSH
> }
>
> do_rootfs_postprocess[vardeps] = "${ROOTFS_POSTPROCESS_COMMAND}"
> --
> 2.47.3
>
--
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/a4b691e5-6e24-4883-ab81-dfd3793df250%40ilbers.de.
next prev parent reply other threads:[~2026-06-15 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 13:02 'Badrikesh Prusty' via isar-users
2026-06-15 9:02 ` Zhihang Wei [this message]
2026-06-19 20:37 ` 'Heinisch, Alexander' via isar-users
2026-06-20 4:35 ` 'Prusty, Badrikesh' 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=a4b691e5-6e24-4883-ab81-dfd3793df250@ilbers.de \
--to=wzh@ilbers.de \
--cc=alexander.heinisch@siemens.com \
--cc=badrikesh.prusty@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=gokhan.cetin@siemens.com \
--cc=isar-users@googlegroups.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