* Re: [PATCH] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-19 15:36 [PATCH] classes/image-postproc-extension: Remove /etc/machine-id Q. Gylstorff
@ 2022-04-19 16:15 ` Jan Kiszka
2022-04-20 9:00 ` Henning Schild
2022-04-19 19:10 ` Anton Mikanovich
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2022-04-19 16:15 UTC (permalink / raw)
To: Q. Gylstorff, isar-users, Su, Bao Cheng (RC-CN DF FA R&D)
On 19.04.22 17:36, Q. Gylstorff wrote:
> From: kas <kas@example.com>
>
> In a read-only system the machine id should be deleted or
> set to `unitialized\n`[1].
>
> Systemd will generate a new machine-id during the first boot.
> In the case of a read-only root file system Systemd generates a mount point with
> the machine id. If an overlay for /etc is used this creates a mount conflict.
> To avoid the conflict between the overlay filesystem and systemd /etc/machine-id
> mount point deleted the file /etc/machine-id.
>
> [1]: https://systemd.io/BUILDING_IMAGES/
>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> meta/classes/image-postproc-extension.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
> index ca520273..0c412c0d 100644
> --- a/meta/classes/image-postproc-extension.bbclass
> +++ b/meta/classes/image-postproc-extension.bbclass
> @@ -57,7 +57,7 @@ ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
> image_postprocess_machine_id() {
> # systemd(1) takes care of recreating the machine-id on first boot
> sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> - sudo install -m 644 '/dev/null' '${IMAGE_ROOTFS}/etc/machine-id'
> + sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> }
>
> ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
This partially reverts 98d6a72d3064. Did you read that commit and can
you comment on it in your patch?
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-19 16:15 ` Jan Kiszka
@ 2022-04-20 9:00 ` Henning Schild
0 siblings, 0 replies; 8+ messages in thread
From: Henning Schild @ 2022-04-20 9:00 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Q. Gylstorff, isar-users, Su, Bao Cheng (RC-CN DF FA R&D)
Am Tue, 19 Apr 2022 18:15:10 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> On 19.04.22 17:36, Q. Gylstorff wrote:
> > From: kas <kas@example.com>
> >
> > In a read-only system the machine id should be deleted or
> > set to `unitialized\n`[1].
> >
> > Systemd will generate a new machine-id during the first boot.
> > In the case of a read-only root file system Systemd generates a
> > mount point with the machine id. If an overlay for /etc is used
> > this creates a mount conflict. To avoid the conflict between the
> > overlay filesystem and systemd /etc/machine-id mount point deleted
> > the file /etc/machine-id.
> >
> > [1]: https://systemd.io/BUILDING_IMAGES/
> >
> > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > ---
> > meta/classes/image-postproc-extension.bbclass | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/image-postproc-extension.bbclass
> > b/meta/classes/image-postproc-extension.bbclass index
> > ca520273..0c412c0d 100644 ---
> > a/meta/classes/image-postproc-extension.bbclass +++
> > b/meta/classes/image-postproc-extension.bbclass @@ -57,7 +57,7 @@
> > ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
> > image_postprocess_machine_id() { # systemd(1) takes care of
> > recreating the machine-id on first boot sudo rm -f
> > '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> > - sudo install -m 644 '/dev/null'
> > '${IMAGE_ROOTFS}/etc/machine-id'
> > + sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> > }
> >
> > ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
>
> This partially reverts 98d6a72d3064. Did you read that commit and can
> you comment on it in your patch?
In fact the man pages changes a bit from buster to bullseye, but having
the machine-id being an empty file still seems the most generic way
which should cover both older and newer systemd. However we will never
have a "first boot" "ConditionFirstBoot=yes" when using that empty
file, i tend to think removal is the correct way ... at least for newer
systemd.
https://manpages.debian.org/buster/systemd/machine-id.5.en.html
says
> Having an empty file in place is useful because it allows a temporary
> file to be bind-mounted over the real file, in case the image is used
> read-only.
https://manpages.debian.org/bullseye/systemd/machine-id.5.en.html
says
> 3.If /etc/machine-id exists and is empty, a boot is not considered
> the first boot. systemd will still bind-mount a file containing the
> actual machine-id over it and later try to commit it to disk (if
> /etc/ is writable).
Which makes me wonder if we want systemd to know that it is the first
boot, i bet we would want that ... and not want an empty machine id.
Also the link quirin sent ... coming directly from systemd says one
should remove the file.
Maybe things really changed between buster and bullseye and we need to
do other things for more recent systemd.
Henning
> Jan
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-19 15:36 [PATCH] classes/image-postproc-extension: Remove /etc/machine-id Q. Gylstorff
2022-04-19 16:15 ` Jan Kiszka
@ 2022-04-19 19:10 ` Anton Mikanovich
2022-04-20 7:28 ` [PATCH v2] " Quirin Gylstorff
2022-04-20 8:44 ` [PATCH] " Henning Schild
3 siblings, 0 replies; 8+ messages in thread
From: Anton Mikanovich @ 2022-04-19 19:10 UTC (permalink / raw)
To: Q. Gylstorff, isar-users; +Cc: jan.kiszka
19.04.2022 18:36, Q. Gylstorff wrote:
> From: kas <kas@example.com>
>
> In a read-only system the machine id should be deleted or
> set to `unitialized\n`[1].
>
> Systemd will generate a new machine-id during the first boot.
> In the case of a read-only root file system Systemd generates a mount point with
> the machine id. If an overlay for /etc is used this creates a mount conflict.
> To avoid the conflict between the overlay filesystem and systemd /etc/machine-id
> mount point deleted the file /etc/machine-id.
>
> [1]: https://systemd.io/BUILDING_IMAGES/
>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> meta/classes/image-postproc-extension.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
> index ca520273..0c412c0d 100644
> --- a/meta/classes/image-postproc-extension.bbclass
> +++ b/meta/classes/image-postproc-extension.bbclass
> @@ -57,7 +57,7 @@ ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
> image_postprocess_machine_id() {
> # systemd(1) takes care of recreating the machine-id on first boot
> sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> - sudo install -m 644 '/dev/null' '${IMAGE_ROOTFS}/etc/machine-id'
> + sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> }
>
> ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
Hello, Quirin
Please try to use real 'From' field in patchsets.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-19 15:36 [PATCH] classes/image-postproc-extension: Remove /etc/machine-id Q. Gylstorff
2022-04-19 16:15 ` Jan Kiszka
2022-04-19 19:10 ` Anton Mikanovich
@ 2022-04-20 7:28 ` Quirin Gylstorff
2022-04-20 13:00 ` [PATCH v3] " Quirin Gylstorff
2022-04-20 8:44 ` [PATCH] " Henning Schild
3 siblings, 1 reply; 8+ messages in thread
From: Quirin Gylstorff @ 2022-04-20 7:28 UTC (permalink / raw)
To: jan.kiszka, isar-users
From: kas <kas@example.com>
In a read-only system the machine id should be deleted or
set to `unitialized\n`[1].
Systemd will generate a new machine-id during the first boot.
In the case of a read-only root file system Systemd generates a mount point with
the machine id. If an overlay for /etc is used this creates a mount conflict.
To avoid the conflict between the overlay filesystem and systemd /etc/machine-id
mount point deleted the file /etc/machine-id.
This partly reverts 98d6a72d3064. The man page[2] was updated for Debian Bullseye to
allow a missing machine id. For Debian Bullseye it reads:
```
For operating system images which are created once and used on multiple machines,
for example for containers or in the cloud, /etc/machine-id should be either missing
or an empty file in the generic file system image
```
[1]: https://systemd.io/BUILDING_IMAGES/
[2]: https://manpages.debian.org/bullseye/systemd/machine-id.5.en.html
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
Changes V2:
- add information about revert of 98d6a72d3064
meta/classes/image-postproc-extension.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
index ca520273..0c412c0d 100644
--- a/meta/classes/image-postproc-extension.bbclass
+++ b/meta/classes/image-postproc-extension.bbclass
@@ -57,7 +57,7 @@ ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
image_postprocess_machine_id() {
# systemd(1) takes care of recreating the machine-id on first boot
sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
- sudo install -m 644 '/dev/null' '${IMAGE_ROOTFS}/etc/machine-id'
+ sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
}
ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
--
2.35.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-20 7:28 ` [PATCH v2] " Quirin Gylstorff
@ 2022-04-20 13:00 ` Quirin Gylstorff
2022-05-14 14:04 ` Anton Mikanovich
0 siblings, 1 reply; 8+ messages in thread
From: Quirin Gylstorff @ 2022-04-20 13:00 UTC (permalink / raw)
To: jan.kiszka, isar-users
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
In a read-only system the machine id should be deleted or
set to `unitialized\n`[1].
Systemd will generate a new machine-id during the first boot.
In the case of a read-only root file system Systemd generates a mount point with
the machine id. If an overlay for /etc is used this creates a mount conflict.
To avoid the conflict between the overlay filesystem and systemd /etc/machine-id
mount point deleted the file /etc/machine-id.
This partly reverts 98d6a72d3064. The man page[2] was updated for Debian Bullseye to
allow a missing machine id. For Debian Bullseye it reads:
```
For operating system images which are created once and used on multiple machines,
for example for containers or in the cloud, /etc/machine-id should be either missing
or an empty file in the generic file system image
```
[1]: https://systemd.io/BUILDING_IMAGES/
[2]: https://manpages.debian.org/bullseye/systemd/machine-id.5.en.html
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
Changes V2:
- add information about revert of 98d6a72d3064
Changes V3:
- Fix From:
meta/classes/image-postproc-extension.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/image-postproc-extension.bbclass b/meta/classes/image-postproc-extension.bbclass
index ca520273..0c412c0d 100644
--- a/meta/classes/image-postproc-extension.bbclass
+++ b/meta/classes/image-postproc-extension.bbclass
@@ -57,7 +57,7 @@ ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
image_postprocess_machine_id() {
# systemd(1) takes care of recreating the machine-id on first boot
sudo rm -f '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
- sudo install -m 644 '/dev/null' '${IMAGE_ROOTFS}/etc/machine-id'
+ sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
}
ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
--
2.35.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-20 13:00 ` [PATCH v3] " Quirin Gylstorff
@ 2022-05-14 14:04 ` Anton Mikanovich
0 siblings, 0 replies; 8+ messages in thread
From: Anton Mikanovich @ 2022-05-14 14:04 UTC (permalink / raw)
To: Quirin Gylstorff, jan.kiszka, isar-users
20.04.2022 16:00, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>
> In a read-only system the machine id should be deleted or
> set to `unitialized\n`[1].
>
> Systemd will generate a new machine-id during the first boot.
> In the case of a read-only root file system Systemd generates a mount point with
> the machine id. If an overlay for /etc is used this creates a mount conflict.
> To avoid the conflict between the overlay filesystem and systemd /etc/machine-id
> mount point deleted the file /etc/machine-id.
>
>
> This partly reverts 98d6a72d3064. The man page[2] was updated for Debian Bullseye to
> allow a missing machine id. For Debian Bullseye it reads:
>
> ```
> For operating system images which are created once and used on multiple machines,
> for example for containers or in the cloud, /etc/machine-id should be either missing
> or an empty file in the generic file system image
> ```
>
> [1]: https://systemd.io/BUILDING_IMAGES/
> [2]: https://manpages.debian.org/bullseye/systemd/machine-id.5.en.html
>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Applied to next, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] classes/image-postproc-extension: Remove /etc/machine-id
2022-04-19 15:36 [PATCH] classes/image-postproc-extension: Remove /etc/machine-id Q. Gylstorff
` (2 preceding siblings ...)
2022-04-20 7:28 ` [PATCH v2] " Quirin Gylstorff
@ 2022-04-20 8:44 ` Henning Schild
3 siblings, 0 replies; 8+ messages in thread
From: Henning Schild @ 2022-04-20 8:44 UTC (permalink / raw)
To: Q. Gylstorff; +Cc: jan.kiszka, isar-users
Am Tue, 19 Apr 2022 17:36:40 +0200
schrieb "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>:
> From: kas <kas@example.com>
>
> In a read-only system the machine id should be deleted or
> set to `unitialized\n`[1].
>
> Systemd will generate a new machine-id during the first boot.
> In the case of a read-only root file system Systemd generates a mount
> point with the machine id. If an overlay for /etc is used this
> creates a mount conflict. To avoid the conflict between the overlay
> filesystem and systemd /etc/machine-id mount point deleted the file
> /etc/machine-id.
>
> [1]: https://systemd.io/BUILDING_IMAGES/
This is full of good stuff which should probably go into Isar. i.e.
other files to remove, and systemd-repart systemd-growfs
Or systemd-makefs for additional partitions. While wic can do that as
well, you could quickly run into uuid duplication across devices.
Henning
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> meta/classes/image-postproc-extension.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-postproc-extension.bbclass
> b/meta/classes/image-postproc-extension.bbclass index
> ca520273..0c412c0d 100644 ---
> a/meta/classes/image-postproc-extension.bbclass +++
> b/meta/classes/image-postproc-extension.bbclass @@ -57,7 +57,7 @@
> ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
> image_postprocess_machine_id() { # systemd(1) takes care of
> recreating the machine-id on first boot sudo rm -f
> '${IMAGE_ROOTFS}/var/lib/dbus/machine-id'
> - sudo install -m 644 '/dev/null' '${IMAGE_ROOTFS}/etc/machine-id'
> + sudo rm -f '${IMAGE_ROOTFS}/etc/machine-id'
> }
>
> ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_sshd_key_regen"
^ permalink raw reply [flat|nested] 8+ messages in thread