This patch is forcing systemd to do preset-all at boot time (first boot) in a function that simulates 'preset-all' at rootfs time.

If we look at the comments above the changed line, we can see that the /etc/machine-id file was deliberately created as empty, for the purpose of making systemd not treat the system as first boot.
"""
    # If we populate the systemd links we also create /etc/machine-id, which     # allows systemd to boot with the filesystem read-only before generating
    # a real value and then committing it back.
    #
    # For the stateless configuration, where /etc is generated at runtime
    # (for example on a tmpfs), this script shouldn't run at all and we
    # allow systemd to completely populate /etc.
"""

I'm going to send out a patch to revert this patch.

Regards,
Qi

On 2/28/23 03:15, Marek Vasut wrote:
Instead of creating empty /etc/machine-id file using touch, write
text "uninitialized" into it. Systemd requires "uninitialized" in
the /etc/machine-id file to trigger systemd-firstboot .

Signed-off-by: Marek Vasut <ma...@denx.de>
---
Cc: Alexandre Belloni <alexandre.bell...@bootlin.com>
Cc: Armin Kuster <akuster...@gmail.com>
Cc: Bob Henz <robert_h...@jabil.com>
Cc: Kristian Klausen <krist...@klausen.dk>
Cc: Nick Potenski <nick.poten...@garmin.com>
Cc: Richard Purdie <richard.pur...@linuxfoundation.org>
---
  meta/recipes-core/systemd/systemd-systemctl/systemctl | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl 
b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index cddae75a06..45b29671ee 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -302,7 +302,7 @@ def preset_all(root):
      # For the stateless configuration, where /etc is generated at runtime
      # (for example on a tmpfs), this script shouldn't run at all and we
      # allow systemd to completely populate /etc.
-    (root / SYSCONFDIR / "machine-id").touch()
+    (root / SYSCONFDIR / "machine-id").write_text("uninitialized")
def main():




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178533): 
https://lists.openembedded.org/g/openembedded-core/message/178533
Mute This Topic: https://lists.openembedded.org/mt/97273986/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to