public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Heinisch, Alexander' via isar-users" <isar-users@googlegroups.com>
To: "Prusty, Badrikesh" <badrikesh.prusty@siemens.com>,
	"isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"wzh@ilbers.de" <wzh@ilbers.de>
Cc: "Kiszka, Jan" <jan.kiszka@siemens.com>,
	"MOESSBAUER, Felix" <felix.moessbauer@siemens.com>,
	"Cetin, Gokhan" <gokhan.cetin@siemens.com>
Subject: Re: [PATCH v7] image-postproc: gate systemd preset-all on masked unit state
Date: Wed, 1 Jul 2026 09:41:35 +0000	[thread overview]
Message-ID: <3c44e535412fe136737a186781ebb12f446fb9cb.camel@siemens.com> (raw)
In-Reply-To: <SG2PR06MB5107EE98F5B93B8C5829B18B91E12@SG2PR06MB5107.apcprd06.prod.outlook.com>

Thx for clarifying steps to reproduce.

I followed your steps below with a minor modification to build an
existing image (isar-image-base)

```
./kas/kas-container build kas/isar.yaml:kas/machine/x86-
pc.yaml:kas/distro/debian-
bookworm.yaml:kas/package/pkg_hello.yaml:kas/image/isar-image-base.yaml
```

I could reproduce described log output in bookworm.

But, the error message is caused by a conflict you introduced by
masking /usr/lib/systemd/system/ctrl-alt-del.target!

ctrl-alt-del.target is a link to reboot.target which is explicitly
mentioned enabled in /usr/lib/systemd/system-preset/90-systemd.preset 

Therefore, systemd (in bookworm) emits an error.
Later versions of systemd (e.g. the one shipped with trixie) handle
that more gracefully [1], as mentioned previously.


TL;DR:

I'd propose to revert that "fix" and fix the preset shipped with your
distribution accordingly:

e.g.:
```
echo "disable reboot.target" > /usr/lib/systemd/system-preset/00-
reboot-target-mask.preset
```

BR Alexander


[1]:
https://github.com/systemd/systemd/commit/d41f08bd2ac4cfa58191b64d31ca9e6f3dec7552

On Sat, 2026-06-20 at 04:35 +0000, Prusty, Badrikesh (FT FDS CES LX PBU
2) wrote:
> Hi,
> 
> Here are the simple steps to reproduce the issue:
> 
> 1. Check out Isar without this patch applied.
> 
> 2. Create a recipe to mask a unit. Here I am using `ctrl-alt-
> del.target`
> ```
> > cat meta-isar/recipes-example/no-ctrl-alt-del/no-ctrl-alt-del.bb
> inherit dpkg-raw
> 
> SRC_URI = "file://postinst"
> 
> > cat meta-isar/recipes-example/no-ctrl-alt-del/files/postinst
> #!/bin/sh
> 
> systemctl mask ctrl-alt-del.target
> ```
> 
> 3. Install it to the rootfs:
> ```
> > git diff
> diff --git a/kas/package/pkg_hello.yaml b/kas/package/pkg_hello.yaml
> index ea2bce8e..382acd29 100644
> --- a/kas/package/pkg_hello.yaml
> +++ b/kas/package/pkg_hello.yaml
> @@ -6,4 +6,4 @@ header:
> 
>  local_conf_header:
>    package-hello: |
> -    IMAGE_INSTALL:append = " hello"
> +    IMAGE_INSTALL:append = " hello no-ctrl-alt-del"
> ```
> 
> 4. Trigger a build with distro set to debian-bookworm:
> ```
> > ./kas/kas-container build kas/isar.yaml:kas/machine/x86-
> > pc.yaml:kas/distro/debian-bookworm.yaml:kas/package/pkg_hello.yaml
> ```
> 
> Error log:
> ```
> > DEBUG: Executing shell function
> > image_postprocess_populate_systemd_preset
> > Failed to preset unit, unit /etc/systemd/system/systemd-
> > firstboot.service is masked.
> > Failed to preset unit, unit /etc/systemd/system/ctrl-alt-del.target
> > is masked.
> > Failed to preset unit, unit /lib/systemd/system/x11-common.service
> > is masked.
> > Failed to preset unit, unit /lib/systemd/system/rc.service is
> > masked.
> > Failed to preset unit, unit /lib/systemd/system/cryptdisks.service
> > is masked.
> > Failed to preset unit, unit /lib/systemd/system/cryptdisks-
> > early.service is masked.
> > Failed to preset unit, unit /lib/systemd/system/rcS.service is
> > masked.
> > Failed to preset unit, unit /lib/systemd/system/hwclock.service is
> > masked.
> > Unit /etc/systemd/system/systemd-firstboot.service is masked,
> > ignoring.
> > Unit /etc/systemd/system/ctrl-alt-del.target is masked, ignoring.
> > Created symlink /etc/systemd/system/multi-user.target.wants/remote-
> > cryptsetup.target → /lib/systemd/system/remote-cryptsetup.target.
> > Created symlink /etc/systemd/system/sysinit.target.wants/systemd-
> > sysext.service → /lib/systemd/system/systemd-sysext.service.
> > Unit /lib/systemd/system/x11-common.service is masked, ignoring.
> > Unit /lib/systemd/system/rc.service is masked, ignoring.
> > Failed to preset unit, file "/etc/systemd/system/ctrl-alt-
> > del.target" already exists and is a symlink to "/dev/null".
> ```
> 
> Many thanks,
> Badrikesh
> 
> -----Original Message-----
> From: Heinisch, Alexander (FT RPD CED SES-AT)
> <alexander.heinisch@siemens.com> 
> Sent: 20 June 2026 02:07
> To: Prusty, Badrikesh (FT FDS CES LX PBU 2)
> <badrikesh.prusty@siemens.com>; isar-users@googlegroups.com;
> wzh@ilbers.de
> Cc: Kiszka, Jan (FT RPD CED) <jan.kiszka@siemens.com>; Moessbauer,
> Felix (FT RPD CED OES-DE) <felix.moessbauer@siemens.com>; Çetin,
> Gökhan (FT D EU TR C&E) <gokhan.cetin@siemens.com>
> Subject: Re: [PATCH v7] image-postproc: gate systemd preset-all on
> masked unit state
> 
> On Mon, 2026-06-15 at 11:02 +0200, Zhihang Wei wrote:
> > 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")
> Sorry for the (too)late reply.
> 
> Can you elaborate what this fix is about?
> 
> At least on my systems (and according to documentation) preset-all --
> preset-mode="enable-only" handles masked services gracefully.
> 
> The command emits:
> "Unit [redacted].service is masked, ignoring." correctly.
> but exits with exit code 0.
> 
> Further, the previous behavior is exactly what systemd does on first
> boot anyways.
> 
> BR Alexander
> 
> > > 
> > > 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
> > > 
> 
> --
> Alexander Heinisch
> Siemens AG
> www.siemens.com

-- 
Alexander Heinisch
Siemens AG
www.siemens.com

-- 
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/3c44e535412fe136737a186781ebb12f446fb9cb.camel%40siemens.com.

      reply	other threads:[~2026-07-01  9:41 UTC|newest]

Thread overview: 5+ 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
2026-06-19 20:37   ` 'Heinisch, Alexander' via isar-users
2026-06-20  4:35     ` 'Prusty, Badrikesh' via isar-users
2026-07-01  9:41       ` 'Heinisch, Alexander' via isar-users [this message]

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=3c44e535412fe136737a186781ebb12f446fb9cb.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=alexander.heinisch@siemens.com \
    --cc=badrikesh.prusty@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=gokhan.cetin@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=wzh@ilbers.de \
    /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