[v2,2/2] image: make populate-systemd-preset opt-in

Message ID 20260113144832.3231870-2-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
Disable running populate-systemd-preset at build time by default.
Although systemd runs enable-only presets at first boot, running this
step during image creation changes the enabled state of units before
systemd’s first-boot logic runs, ignores disable rules, and can cause
some services to fail during runtime.

Downstream users can opt in when preset population is required.

Opt-in:
  ROOTFS_FEATURES:append = " populate-systemd-preset"

Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
 RECIPE-API-CHANGELOG.md           | 14 ++++++++++++++
 meta/classes-recipe/image.bbclass |  1 -
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Heinisch, Alexander Jan. 14, 2026, 9:46 a.m. UTC | #1
On Tue, 2026-01-13 at 09:48 -0500, Badrikesh Prusty wrote:
> Disable running populate-systemd-preset at build time by default.
> Although systemd runs enable-only presets at first boot, running this
> step during image creation changes the enabled state of units before
> systemd’s first-boot logic runs, 
Why is this a problem? The reasons why to have services prepopulated
are listed here [1].

> ignores disable rules, and can cause
...as is the case with current systemd

> some services to fail during runtime.

What's the difference compared to enabling on first-boot?
> 
> Downstream users can opt in when preset population is required.

Imo, having the pre population enabled seems to me a propper default.
If downstream has issues with the prepopulation, for some reason (maybe
you can clarify based on concrete cases) then you always can opt-out
via: ROOTFS_FEATURES:remove = "populate-systemd-preset"

Initially your V1 was about not only enabling but also disabling
services in the postprocessing. What caused the change to neither
populate enabled nor disabled units? As above, maybe a concrete example
helps to understand your requirements.

BR Alexander

1:
https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#populate-systemd-units-based-on-presets-during-image-postprocessing

> 
> Opt-in:
>   ROOTFS_FEATURES:append = " populate-systemd-preset"
> 
> Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md           | 14 ++++++++++++++
>  meta/classes-recipe/image.bbclass |  1 -
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 0bad8a44..46c8c905 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -962,3 +962,17 @@ INSTALLER_UNATTENDED_ABORT_ENABLE = "1"
>  # Optional: set countdown timeout in seconds (default 5)
>  INSTALLER_UNATTENDED_ABORT_TIMEOUT = "5"
>  ```
> +
> +### Make populate-systemd-preset opt-in
> +
> +Running populate-systemd-preset at build time is disabled by
> default.
> +Although systemd runs enable-only presets by default at first boot,
> +running this step at build time changes the enabled state of units
> +before systemd’s first-boot logic runs, ignores disable rules, and
> +can cause some services to fail during runtime.
> +
> +Downstream users can explicitly enable this feature when preset
> +population is required during image creation.
> +
> +Opt-in:
> +  ROOTFS_FEATURES:append = " populate-systemd-preset"
> diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-
> recipe/image.bbclass
> index e605bc80..47ed068d 100644
> --- a/meta/classes-recipe/image.bbclass
> +++ b/meta/classes-recipe/image.bbclass
> @@ -101,7 +101,6 @@ ROOTFS_FEATURES += "\
>      export-dpkg-status \
>      clean-log-files \
>      clean-debconf-cache \
> -    populate-systemd-preset \
>      generate-sbom \
>      "
>  ROOTFS_PACKAGES += "${IMAGE_PREINSTALL}
> ${@isar_multiarch_packages('IMAGE_INSTALL', d)}"

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 0bad8a44..46c8c905 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -962,3 +962,17 @@  INSTALLER_UNATTENDED_ABORT_ENABLE = "1"
 # Optional: set countdown timeout in seconds (default 5)
 INSTALLER_UNATTENDED_ABORT_TIMEOUT = "5"
 ```
+
+### Make populate-systemd-preset opt-in
+
+Running populate-systemd-preset at build time is disabled by default.
+Although systemd runs enable-only presets by default at first boot,
+running this step at build time changes the enabled state of units
+before systemd’s first-boot logic runs, ignores disable rules, and
+can cause some services to fail during runtime.
+
+Downstream users can explicitly enable this feature when preset
+population is required during image creation.
+
+Opt-in:
+  ROOTFS_FEATURES:append = " populate-systemd-preset"
diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index e605bc80..47ed068d 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -101,7 +101,6 @@  ROOTFS_FEATURES += "\
     export-dpkg-status \
     clean-log-files \
     clean-debconf-cache \
-    populate-systemd-preset \
     generate-sbom \
     "
 ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_multiarch_packages('IMAGE_INSTALL', d)}"