public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Gylstorff Quirin <quirin.gylstorff@siemens.com>
To: "Moessbauer, Felix (T CED SES-DE)" <felix.moessbauer@siemens.com>,
	"isar-users@googlegroups.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: Bug: machine id is never generated
Date: Fri, 22 Jul 2022 11:32:50 +0200	[thread overview]
Message-ID: <5008a403-2669-5579-ff99-e0b5a8f08647@siemens.com> (raw)
In-Reply-To: <AM9PR10MB4869077CB154BCBE9587037D89919@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM>



On 7/21/22 17:41, Moessbauer, Felix (T CED SES-DE) wrote:
> Hi,
> 
> when booting plain ISAR images (with Debian11), the "/etc/machine-id" is never generated.
> This breaks a couple of services that depend on having the id.
> An example is the systemd-networkd with DHCP, leading to error messages like this one (and breaking networking):
> 
> systemd-networkd[277]: enp8s0: DHCP6 CLIENT: Failed to set identifier: No such file or directory
> 
> The error can manually be fixed by running "systemd-machine-id-setup", but this obviously does not work in embedded scenarios.
> 
> The root cause could be that /etc is read-only mounted when the first-boot-complete.target is reached.
> At least the logs indicate this:
> 
> journalctl --grep machine --no-pager
> -- Journal begins at Thu 2022-07-21 15:07:21 UTC, ends at Thu 2022-07-21 15:35:20 UTC. --
> Jul 21 15:07:21 test-image systemd[1]: System cannot boot: Missing /etc/machine-id and /etc is mounted read-only.
> Jul 21 15:07:21 test-image systemd[1]: 1) /etc/machine-id exists and is populated.
> Jul 21 15:07:21 test-image systemd[1]: 2) /etc/machine-id exists and is empty.
> Jul 21 15:07:21 test-image systemd[1]: 3) /etc/machine-id is missing and /etc is writable.
> Jul 21 15:07:24 test-image systemd[1]: Condition check resulted in Commit a transient machine-id on disk being skipped.

/etc is read only after the initrd gives control to systemd. The remount 
from ro to rw of the rootfs occurs in systemd.


I tested it with my Debian machine and without /etc/machine-id to same 
behavior occurs.

 From my testing setting '/etc/machine-id' to "unitialized\n" results in 
the intended behavior with active first boot mechanic.


```
modified   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 rm -f '${IMAGE_ROOTFS}/etc/machine-id'
+    echo  "uninitialized\n"  | sudo tee '${IMAGE_ROOTFS}/etc/machine-id'
  }
```

This still needs to be tested with other images.

Quirin
> 
> Maybe Quirin knows more, as he implemented the postproc removal in 8b5e3f9.
> IIRC Jan also mentioned something that "rw" has to be added to the kernel cmdline, but this looks like a workaround as well.


> For the sake of completeness:
> 
> cat /proc/cmdline

> initrd=\initrd.img-5.10.0-16-amd64 LABEL=Boot root=PARTUUID=9ad286e9-8df8-42c2-ac7d-0f2d7387d03d rootwait console=tty0 console=ttyS0,115200
> 
> IMO this is a pretty critical bug as it affects a ton of images.
> 
> Best regards,
> Felix



  parent reply	other threads:[~2022-07-22  9:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 15:41 Moessbauer, Felix
2022-07-21 16:26 ` Henning Schild
2022-07-21 17:08 ` Schmidl, Tobias
2022-07-22 19:54   ` Henning Schild
2022-07-22  9:32 ` Gylstorff Quirin [this message]
2022-07-22 10:55   ` Gylstorff Quirin
2022-10-06 13:22 ` Henning Schild
2022-10-07  7:11   ` Moessbauer, Felix
2022-10-07  8:12     ` Henning Schild

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=5008a403-2669-5579-ff99-e0b5a8f08647@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=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