[v2,1/2] image-postproc: ignore systemd preset failures

Message ID 20260113144832.3231870-1-badrikesh.prusty@siemens.com
State Under Review
Headers show
Series [v2,1/2] image-postproc: ignore systemd preset failures | expand

Commit Message

Badrikesh Prusty Jan. 13, 2026, 2:48 p.m. UTC
Add '|| true' to systemd preset invocation during image postprocessing
to tolerate failures caused by already-masked units.

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 meta/classes-recipe/rootfs.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Bezdeka Jan. 13, 2026, 2:55 p.m. UTC | #1
On Tue, 2026-01-13 at 09:48 -0500, 'Badrikesh Prusty' via isar-users
wrote:
> Add '|| true' to systemd preset invocation during image postprocessing
> to tolerate failures caused by already-masked units.

Hm. It's an assumption that this can only fail because of already-masked
units, no? Looking at the implementation below it looks more like that
we hide any error now.

> 
> Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
> ---
>  meta/classes-recipe/rootfs.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
> index 8485b32f..ef3ddb84 100644
> --- a/meta/classes-recipe/rootfs.bbclass
> +++ b/meta/classes-recipe/rootfs.bbclass
> @@ -574,7 +574,7 @@ image_postprocess_populate_systemd_preset() {
>          --show systemd || echo "" )
>  
>      if (test "$SYSTEMD_INSTALLED" = "installed"); then
> -        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
> +        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only" || true
>      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/20260113144832.3231870-1-badrikesh.prusty%40siemens.com.
Badrikesh Prusty Jan. 13, 2026, 3:13 p.m. UTC | #2
Hi,

>> Hm. It's an assumption that this can only fail because of already-masked
>> units, no? Looking at the implementation below it looks more like that
>> we hide any error now.
>>

Definitely not just an assumption, that’s one concrete reason among others.
For example, I have a package that runs `systemctl mask <service>` in its
postinst script of a package getting installed to rootfs during the 
rootfs_install
task. When the image postprocessing runs `systemctl preset ....` , it fails
because it tries to enable that masked service.

Thanks,
Badrikesh
On Tuesday, January 13, 2026 at 8:25:17 PM UTC+5:30 Florian Bezdeka wrote:

> On Tue, 2026-01-13 at 09:48 -0500, 'Badrikesh Prusty' via isar-users
> wrote:
> > Add '|| true' to systemd preset invocation during image postprocessing
> > to tolerate failures caused by already-masked units.
>
> Hm. It's an assumption that this can only fail because of already-masked
> units, no? Looking at the implementation below it looks more like that
> we hide any error now.
>
> > 
> > Signed-off-by: Badrikesh Prusty <badrikes...@siemens.com>
> > ---
> > meta/classes-recipe/rootfs.bbclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes-recipe/rootfs.bbclass 
> b/meta/classes-recipe/rootfs.bbclass
> > index 8485b32f..ef3ddb84 100644
> > --- a/meta/classes-recipe/rootfs.bbclass
> > +++ b/meta/classes-recipe/rootfs.bbclass
> > @@ -574,7 +574,7 @@ image_postprocess_populate_systemd_preset() {
> > --show systemd || echo "" )
> > 
> > if (test "$SYSTEMD_INSTALLED" = "installed"); then
> > - sudo chroot '${ROOTFSDIR}' systemctl preset-all 
> --preset-mode="enable-only"
> > + sudo chroot '${ROOTFSDIR}' systemctl preset-all 
> --preset-mode="enable-only" || true
> > 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+...@googlegroups.com.
> > To view this discussion visit 
> https://groups.google.com/d/msgid/isar-users/20260113144832.3231870-1-badrikesh.prusty%40siemens.com
> .
>

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 8485b32f..ef3ddb84 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -574,7 +574,7 @@  image_postprocess_populate_systemd_preset() {
         --show systemd || echo "" )
 
     if (test "$SYSTEMD_INSTALLED" = "installed"); then
-        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only"
+        sudo chroot '${ROOTFSDIR}' systemctl preset-all --preset-mode="enable-only" || true
     fi
 }