* [PATCH v2 0/1] fix on-first-boot for systemd >= 247
@ 2022-07-25 21:09 Felix Moessbauer
2022-07-25 21:09 ` [PATCH v2 1/1] " Felix Moessbauer
2022-08-01 15:52 ` [PATCH v2 0/1] " Anton Mikanovich
0 siblings, 2 replies; 7+ messages in thread
From: Felix Moessbauer @ 2022-07-25 21:09 UTC (permalink / raw)
To: isar-users; +Cc: tobiasschmidl, henning.schild, jan.kiszka, Felix Moessbauer
Changes since v1:
- check if systemd is installed
Felix Moessbauer (1):
fix on-first-boot for systemd >= 247
meta/classes/image-postproc-extension.bbclass | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.30.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/1] fix on-first-boot for systemd >= 247
2022-07-25 21:09 [PATCH v2 0/1] fix on-first-boot for systemd >= 247 Felix Moessbauer
@ 2022-07-25 21:09 ` Felix Moessbauer
2022-07-26 9:09 ` Moessbauer, Felix
2022-08-01 15:52 ` [PATCH v2 0/1] " Anton Mikanovich
1 sibling, 1 reply; 7+ messages in thread
From: Felix Moessbauer @ 2022-07-25 21:09 UTC (permalink / raw)
To: isar-users; +Cc: tobiasschmidl, henning.schild, jan.kiszka, Felix Moessbauer
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/1] fix on-first-boot for systemd >= 247
2022-07-25 21:09 ` [PATCH v2 1/1] " Felix Moessbauer
@ 2022-07-26 9:09 ` Moessbauer, Felix
2022-07-27 9:20 ` Henning Schild
0 siblings, 1 reply; 7+ messages in thread
From: Moessbauer, Felix @ 2022-07-26 9:09 UTC (permalink / raw)
To: isar-users; +Cc: Schmidl, Tobias, Schild, Henning, jan.kiszka
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/1] fix on-first-boot for systemd >= 247
2022-07-26 9:09 ` Moessbauer, Felix
@ 2022-07-27 9:20 ` Henning Schild
0 siblings, 0 replies; 7+ messages in thread
From: Henning Schild @ 2022-07-27 9:20 UTC (permalink / raw)
To: Moessbauer, Felix (T CED SES-DE)
Cc: isar-users, Schmidl, Tobias (T CED SES-DE), Kiszka, Jan (T CED),
Harald Seiler
Am Tue, 26 Jul 2022 11:09:21 +0200
schrieb "Moessbauer, Felix (T CED SES-DE)"
<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]
Not sure rahix is a dev or another victim ... or both ;).
> The GH issue is really worth a read 😉
I read it, but not in depth. My personal conclusion would still be to
stay away from all features that have not been hanging for at least 2
years ;). So NM over networkd, ntp over timedatectrl and so on. And if
you can openrc ;)
Henning
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/1] fix on-first-boot for systemd >= 247
2022-07-25 21:09 [PATCH v2 0/1] fix on-first-boot for systemd >= 247 Felix Moessbauer
2022-07-25 21:09 ` [PATCH v2 1/1] " Felix Moessbauer
@ 2022-08-01 15:52 ` Anton Mikanovich
2022-08-01 16:28 ` Moessbauer, Felix
1 sibling, 1 reply; 7+ messages in thread
From: Anton Mikanovich @ 2022-08-01 15:52 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: tobiasschmidl, henning.schild, jan.kiszka
26.07.2022 00:09, Felix Moessbauer wrote:
> Changes since v1:
>
> - check if systemd is installed
>
> Felix Moessbauer (1):
> fix on-first-boot for systemd >= 247
>
> meta/classes/image-postproc-extension.bbclass | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
Hello,
Because this is not working in buster systemd version should be changed.
The best way will be to find out exact one, but looks like ">= 241" just
works.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 0/1] fix on-first-boot for systemd >= 247
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
0 siblings, 1 reply; 7+ messages in thread
From: Moessbauer, Felix @ 2022-08-01 16:28 UTC (permalink / raw)
To: Anton Mikanovich, isar-users; +Cc: Schmidl, Tobias, Schild, Henning, jan.kiszka
> -----Original Message-----
> From: Anton Mikanovich <amikan@ilbers.de>
> Sent: Monday, August 1, 2022 5:52 PM
> To: Moessbauer, Felix (T CED SES-DE) <felix.moessbauer@siemens.com>;
> 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>
> Subject: Re: [PATCH v2 0/1] fix on-first-boot for systemd >= 247
>
> 26.07.2022 00:09, Felix Moessbauer wrote:
> > Changes since v1:
> >
> > - check if systemd is installed
> >
> > Felix Moessbauer (1):
> > fix on-first-boot for systemd >= 247
> >
> > meta/classes/image-postproc-extension.bbclass | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> Hello,
> Because this is not working in buster systemd version should be changed.
> The best way will be to find out exact one, but looks like ">= 241" just works.
Hi,
as stated in the patch, this solution will only work for systemd >= 247 as there the "uninitialized" support has been added.
As there is not systemd >= 247 for buster, we simply cannot support it OOTB.
For buster, you have to make the rootfs rw right from the beginning on, so the /etc/machine-id file can be created.
That's why we have two code paths in the patch.
Felix
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/1] fix on-first-boot for systemd >= 247
2022-08-01 16:28 ` Moessbauer, Felix
@ 2022-08-02 7:56 ` Anton Mikanovich
0 siblings, 0 replies; 7+ messages in thread
From: Anton Mikanovich @ 2022-08-02 7:56 UTC (permalink / raw)
To: Moessbauer, Felix, isar-users
Cc: Schmidl, Tobias, Schild, Henning, jan.kiszka
01.08.2022 19:28, Moessbauer, Felix wrote:
>> Hi,
>>
>> as stated in the patch, this solution will only work for systemd >= 247 as there the "uninitialized" support has been added.
>> As there is not systemd >= 247 for buster, we simply cannot support it OOTB.
>> For buster, you have to make the rootfs rw right from the beginning on, so the /etc/machine-id file can be created.
>> That's why we have two code paths in the patch.
>>
>> Felix
>>
Hm, I've tried to set machine-id to 'uninitialized' for Buster and it
worked.
But looks like even create empty file do the trick.
Creating empty machine-id makes even Bullseye systemd generate id, but we
probably should follow official way with 'uninitialized' there. So the new
proposal is to create empty file for <247 and 'uninitialized' for others.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-08-02 7:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 21:09 [PATCH v2 0/1] fix on-first-boot for systemd >= 247 Felix Moessbauer
2022-07-25 21:09 ` [PATCH v2 1/1] " Felix Moessbauer
2022-07-26 9:09 ` Moessbauer, Felix
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox