From: "Moessbauer, Felix" <felix.moessbauer@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "Schmidl, Tobias" <tobiasschmidl@siemens.com>,
"Schild, Henning" <henning.schild@siemens.com>,
"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>
Subject: RE: [PATCH v2 1/1] fix on-first-boot for systemd >= 247
Date: Tue, 26 Jul 2022 09:09:21 +0000 [thread overview]
Message-ID: <AM9PR10MB486992726CC50401E30EEFC989949@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20220725210915.3008422-2-felix.moessbauer@siemens.com>
FYI: We have a confirmation from systemd devs, that using "uninitialized" is the correct strategy.
They also mention what to consider when using ConditionFirstBoot=.
For technical details, see [1]
The GH issue is really worth a read 😉
Felix
[1] https://github.com/systemd/systemd/issues/14131#issuecomment-1194015162
> -----Original Message-----
> From: Moessbauer, Felix (T CED SES-DE) <felix.moessbauer@siemens.com>
> Sent: Monday, July 25, 2022 11:09 PM
> To: isar-users@googlegroups.com
> Cc: Schmidl, Tobias (T CED SES-DE) <tobiasschmidl@siemens.com>; Schild,
> Henning (T CED SES-DE) <henning.schild@siemens.com>; Kiszka, Jan (T CED)
> <jan.kiszka@siemens.com>; Moessbauer, Felix (T CED SES-DE)
> <felix.moessbauer@siemens.com>
> Subject: [PATCH v2 1/1] fix on-first-boot for systemd >= 247
>
> This patch fixes the bug that /etc/machine-id is never generated when
> running from within an initrd with an ro rootfs.
>
> In this case, the magic value "uninitialized" has to be used instead of deleting
> the file.
>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
> meta/classes/image-postproc-extension.bbclass | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-postproc-extension.bbclass
> b/meta/classes/image-postproc-extension.bbclass
> index 0c412c0d..f9e26c1e 100644
> --- a/meta/classes/image-postproc-extension.bbclass
> +++ b/meta/classes/image-postproc-extension.bbclass
> @@ -56,8 +56,15 @@ image_postprocess_mark() {
> ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
> image_postprocess_machine_id() {
> # systemd(1) takes care of recreating the machine-id on first boot
> + # for systemd < v247, remove the file, 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" )
> + if dpkg --compare-versions "$SYSTEMD_VERSION" "lt" "247"; then
> + sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> + else
> + echo "uninitialized" | sudo tee '${IMAGE_ROOTFS}/etc/machine-id'
> + fi
> sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> - sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> }
>
> ROOTFS_POSTPROCESS_COMMAND =+
> "image_postprocess_sshd_key_regen"
> --
> 2.30.2
next prev parent reply other threads:[~2022-07-26 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 21:09 [PATCH v2 0/1] " Felix Moessbauer
2022-07-25 21:09 ` [PATCH v2 1/1] " Felix Moessbauer
2022-07-26 9:09 ` Moessbauer, Felix [this message]
2022-07-27 9:20 ` Henning Schild
2022-08-01 15:52 ` [PATCH v2 0/1] " Anton Mikanovich
2022-08-01 16:28 ` Moessbauer, Felix
2022-08-02 7:56 ` Anton Mikanovich
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=AM9PR10MB486992726CC50401E30EEFC989949@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM \
--to=felix.moessbauer@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=tobiasschmidl@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