[OE-core] systemd and /etc/machine-id

Patrick Ohly patrick.ohly at intel.com
Sun Mar 5 16:15:23 UTC 2017


On Sun, 2017-03-05 at 10:40 +0100, Nicolas Dechesne wrote:
> hi,
> 
> I am trying to understand why the systemd recipe creates an
> empty /etc/machine-id file:
> 
> # Create machine-id
>            
> # 20:12 < mezcalero> koen: you have three options: a) run
> systemd-machine-id-setup at install time, b) have / read-only and an
> empty file there (for stateless) and c) boot with / writable
> touch ${D}${sysconfdir}/machine-id

It's probably done for case b, the read-only rootfs (both when never
mounted read/write and when initially read-only until fsck completes).

systemd mounts a temporary machine-id over the empty file while the
rootfs is read-only. This is definitely needed for the permanently
read-only rootfs, because several services (for example, journald, if I
remember correctly) do not run without a valid machine-id.

I'm not 100% sure whether the "read-only initially" case also needs the
file. If not, then perhaps it can be limited to images with "read-only"
in IMAGE_FEATURES?

> Having an empty machine-id file seems to prevent the
> "ConditionFirstBoot" to be ever met, e.g. I have a service that tries
> to use it, and at first boot i am seeing in systemctl status:
> 
> ConditionFirstBoot=yes was not met

When the rootfs is read-only permanently, does this condition still make
sense? Probably not, because each boot would be considered a "first
boot". Just wondering how this condition could be handled better.



-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.






More information about the Openembedded-core mailing list