* [PATCH] image-postproc-extension: fix machine-id file being written empty
@ 2026-09-23 18:13 'Badrikesh Prusty' via isar-users
2026-09-23 18:41 ` 'MOESSBAUER, Felix' via isar-users
2026-09-30 10:43 ` Zhihang Wei
0 siblings, 2 replies; 3+ messages in thread
From: 'Badrikesh Prusty' via isar-users @ 2026-09-23 18:13 UTC (permalink / raw)
To: isar-users; +Cc: felix.moessbauer, Badrikesh Prusty
The pipe operation was lost when passing data to run_in_chroot because
run_privileged_heredoc consumes stdin for the heredoc script, resulting
in an empty /etc/machine-id file.
Move the pipe operation inside the chroot environment to fix it. This
ensures /etc/machine-id is properly written with either "uninitialized"
(systemd >= 247) or empty string (systemd < 247).
Fixes: 14acf490 ("introduce wrappers for privileged execution")
Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
meta/classes-recipe/image-postproc-extension.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes-recipe/image-postproc-extension.bbclass b/meta/classes-recipe/image-postproc-extension.bbclass
index 59128c2a..9e37a65b 100644
--- a/meta/classes-recipe/image-postproc-extension.bbclass
+++ b/meta/classes-recipe/image-postproc-extension.bbclass
@@ -63,7 +63,7 @@ image_postprocess_machine_id() {
if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
MACHINE_ID=""
fi
- echo "$MACHINE_ID" | run_in_chroot ${IMAGE_ROOTFS} tee /etc/machine-id
+ run_in_chroot ${IMAGE_ROOTFS} sh -c "echo $MACHINE_ID | tee /etc/machine-id"
run_privileged rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
}
--
2.39.5
--
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/20260923181306.43634-1-badrikesh.prusty%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] image-postproc-extension: fix machine-id file being written empty
2026-09-23 18:13 [PATCH] image-postproc-extension: fix machine-id file being written empty 'Badrikesh Prusty' via isar-users
@ 2026-09-23 18:41 ` 'MOESSBAUER, Felix' via isar-users
2026-09-30 10:43 ` Zhihang Wei
1 sibling, 0 replies; 3+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2026-09-23 18:41 UTC (permalink / raw)
To: Prusty, Badrikesh, isar-users
On Wed, 2026-09-23 at 14:13 -0400, Badrikesh Prusty wrote:
> The pipe operation was lost when passing data to run_in_chroot because
> run_privileged_heredoc consumes stdin for the heredoc script, resulting
> in an empty /etc/machine-id file.
> Move the pipe operation inside the chroot environment to fix it. This
> ensures /etc/machine-id is properly written with either "uninitialized"
> (systemd >= 247) or empty string (systemd < 247).
Good catch!
Reviewed-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Felix
>
> Fixes: 14acf490 ("introduce wrappers for privileged execution")
> Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
> ---
> meta/classes-recipe/image-postproc-extension.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/image-postproc-extension.bbclass b/meta/classes-recipe/image-postproc-extension.bbclass
> index 59128c2a..9e37a65b 100644
> --- a/meta/classes-recipe/image-postproc-extension.bbclass
> +++ b/meta/classes-recipe/image-postproc-extension.bbclass
> @@ -63,7 +63,7 @@ image_postprocess_machine_id() {
> if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
> MACHINE_ID=""
> fi
> - echo "$MACHINE_ID" | run_in_chroot ${IMAGE_ROOTFS} tee /etc/machine-id
> + run_in_chroot ${IMAGE_ROOTFS} sh -c "echo $MACHINE_ID | tee /etc/machine-id"
> run_privileged rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> }
>
> --
> 2.39.5
--
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/23d923e610dc642011bb40e5cf81c2638cfd886c.camel%40siemens.com.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] image-postproc-extension: fix machine-id file being written empty
2026-09-23 18:13 [PATCH] image-postproc-extension: fix machine-id file being written empty 'Badrikesh Prusty' via isar-users
2026-09-23 18:41 ` 'MOESSBAUER, Felix' via isar-users
@ 2026-09-30 10:43 ` Zhihang Wei
1 sibling, 0 replies; 3+ messages in thread
From: Zhihang Wei @ 2026-09-30 10:43 UTC (permalink / raw)
To: Badrikesh Prusty, isar-users; +Cc: felix.moessbauer
Applied to next, thanks.
Zhihang
On 9/23/26 20:13, 'Badrikesh Prusty' via isar-users wrote:
> The pipe operation was lost when passing data to run_in_chroot because
> run_privileged_heredoc consumes stdin for the heredoc script, resulting
> in an empty /etc/machine-id file.
> Move the pipe operation inside the chroot environment to fix it. This
> ensures /etc/machine-id is properly written with either "uninitialized"
> (systemd >= 247) or empty string (systemd < 247).
>
> Fixes: 14acf490 ("introduce wrappers for privileged execution")
> Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
> ---
> meta/classes-recipe/image-postproc-extension.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/image-postproc-extension.bbclass b/meta/classes-recipe/image-postproc-extension.bbclass
> index 59128c2a..9e37a65b 100644
> --- a/meta/classes-recipe/image-postproc-extension.bbclass
> +++ b/meta/classes-recipe/image-postproc-extension.bbclass
> @@ -63,7 +63,7 @@ image_postprocess_machine_id() {
> if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
> MACHINE_ID=""
> fi
> - echo "$MACHINE_ID" | run_in_chroot ${IMAGE_ROOTFS} tee /etc/machine-id
> + run_in_chroot ${IMAGE_ROOTFS} sh -c "echo $MACHINE_ID | tee /etc/machine-id"
> run_privileged rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> }
>
--
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/67edb607-8b8a-4be9-b948-5e09e160e1e4%40ilbers.de.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-30 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 18:13 [PATCH] image-postproc-extension: fix machine-id file being written empty 'Badrikesh Prusty' via isar-users
2026-09-23 18:41 ` 'MOESSBAUER, Felix' via isar-users
2026-09-30 10:43 ` Zhihang Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox