public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'MOESSBAUER, Felix' via isar-users" <isar-users@googlegroups.com>
To: "Heinisch, Alexander" <alexander.heinisch@siemens.com>,
	"isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: Re: [PATCH 1/1] classes/image-postproc: chroot before postprocessing /etc/machine-id
Date: Mon, 14 Jul 2025 11:02:32 +0000	[thread overview]
Message-ID: <9a978a45c3121778e498093b280e73a177e42f9a.camel@siemens.com> (raw)
In-Reply-To: <20250627094756.151803-2-alexander.heinisch@siemens.com>

On Fri, 2025-06-27 at 11:47 +0200, alexander.heinisch via isar-users
wrote:
> From: Alexander Heinisch <alexander.heinisch@siemens.com>
> 
> If /etc/machine-id happens to be a link to e.g. /var/...
> the postprocessing overrides build-hosts /var/... instead of
> the desired file on the rootfs.
> 
> Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
> ---
>  meta/classes/image-postproc-extension.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/image-postproc-extension.bbclass
> b/meta/classes/image-postproc-extension.bbclass
> index 991bac4c..4f2a3d00 100644
> --- a/meta/classes/image-postproc-extension.bbclass
> +++ b/meta/classes/image-postproc-extension.bbclass
> @@ -58,12 +58,12 @@ image_postprocess_machine_id() {
>      # systemd(1) takes care of recreating the machine-id on first
> boot
>      # for systemd < v247, set to empty string, else set to
> uninitialized
>      # (required if initramfs with ro root is used)
> -    SYSTEMD_VERSION=$( sudo chroot ${IMAGE_ROOTFS} dpkg-query --
> showformat='${source:Upstream-Version}' --show systemd || echo "0" )
> +    SYSTEMD_VERSION=$( sudo chroot '${IMAGE_ROOTFS}' dpkg-query --
> showformat='${source:Upstream-Version}' --show systemd || echo "0"

Unrelated fix, please move to separate commit. Please also check if a
IMAGE_ROOTFS with special characters works at all (I doubt it).

> )
>      MACHINE_ID="uninitialized"
>      if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
>          MACHINE_ID=""
>      fi
> -    echo "$MACHINE_ID" | sudo tee '${IMAGE_ROOTFS}/etc/machine-id'
> +    echo "$MACHINE_ID" | sudo chroot '${IMAGE_ROOTFS}' tee
> '/etc/machine-id'

Acked!

Felix

>      sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
>  }
>  
> -- 
> 2.39.5

-- 
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

-- 
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/9a978a45c3121778e498093b280e73a177e42f9a.camel%40siemens.com.

      reply	other threads:[~2025-07-14 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27  9:47 [PATCH 0/1] " alexander.heinisch via isar-users
2025-06-27  9:47 ` [PATCH 1/1] " alexander.heinisch via isar-users
2025-07-14 11:02   ` 'MOESSBAUER, Felix' 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=9a978a45c3121778e498093b280e73a177e42f9a.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=alexander.heinisch@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    /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