public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v5] image-postproc: gate systemd preset-all on masked unit state
@ 2026-04-29  6:43 'Badrikesh Prusty' via isar-users
  2026-04-29 10:41 ` 'Jan Kiszka' via isar-users
  0 siblings, 1 reply; 2+ messages in thread
From: 'Badrikesh Prusty' via isar-users @ 2026-04-29  6:43 UTC (permalink / raw)
  To: isar-users
  Cc: felix.moessbauer, jan.kiszka, gokhan.cetin, alexander.heinisch,
	Badrikesh Prusty

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.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 8b502a50..ca847b30 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -574,7 +574,9 @@ image_postprocess_populate_systemd_preset() {
         --show systemd || echo "" )

     if (test "$SYSTEMD_INSTALLED" = "installed"); then
-        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
+        # Skip preset-all if any masked units exist
+        sudo chroot '${ROOTFSDIR}' systemctl list-unit-files --state=masked --no-legend | grep -q '^' \
+            || sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
     fi
 }

--
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/20260429064353.1372987-1-badrikesh.prusty%40siemens.com.

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

* Re: [PATCH v5] image-postproc: gate systemd preset-all on masked unit state
  2026-04-29  6:43 [PATCH v5] image-postproc: gate systemd preset-all on masked unit state 'Badrikesh Prusty' via isar-users
@ 2026-04-29 10:41 ` 'Jan Kiszka' via isar-users
  0 siblings, 0 replies; 2+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2026-04-29 10:41 UTC (permalink / raw)
  To: Badrikesh Prusty, isar-users
  Cc: felix.moessbauer, gokhan.cetin, alexander.heinisch

On 29.04.26 08:43, Badrikesh Prusty 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.
> 
> 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 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
> index 8b502a50..ca847b30 100644
> --- a/meta/classes-recipe/rootfs.bbclass
> +++ b/meta/classes-recipe/rootfs.bbclass
> @@ -574,7 +574,9 @@ image_postprocess_populate_systemd_preset() {
>          --show systemd || echo "" )
> 
>      if (test "$SYSTEMD_INSTALLED" = "installed"); then
> -        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
> +        # Skip preset-all if any masked units exist
> +        sudo chroot '${ROOTFSDIR}' systemctl list-unit-files --state=masked --no-legend | grep -q '^' \
> +            || sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"

Minor optimization: I would execute the test and preset-all in the same
chroot instance.

Jan

-- 
Siemens AG, Foundational Technologies
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 visit https://groups.google.com/d/msgid/isar-users/3aa5b97c-ccb1-4fff-9b9e-e2396b3a5606%40siemens.com.

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

end of thread, other threads:[~2026-04-29 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-29  6:43 [PATCH v5] image-postproc: gate systemd preset-all on masked unit state 'Badrikesh Prusty' via isar-users
2026-04-29 10:41 ` 'Jan Kiszka' via isar-users

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