[systemd-devel] /etc/machine-id handling in a non-initrd / embedded environment ?!?!

Holger Schurig holgerschurig at gmail.com
Fri Dec 27 02:35:42 PST 2013


Hi all,

I'm using systemd for embedded devices. The kernel is compiled for the
target and I don't need / use an initrd, as all device drivers are
known beforehand and I like the faster boot speed. That means that /
is mounted read-only when systemd starts.

However, systemd (and also journald, as it uses machine_id_setup) has
a handling of /etc/machine-id that doesn't fit here. In effect,
systemd+journald won't run in a system where root is readonly at boot
time and where no /run exists because no initrd did run.


What happens currently?

1. It tries to open /etc/machine-id and fails, because at that point
in time /etc isn't writable.

2. Then it tries to open /etc/machine-id readonly, but again fails, no
machine-id there

3. Now it tries to generate a machine ID and tries to write it into
/run/machine-id. Again this fails, because /run is still on the same
partition as /, and it is still not writable. FAIL !



Wouldn't it be better to just generate the machine-id internally and
pass it by environment/command-line/some-other-means to journald?  And
write it later, once root is writable?

Sure, theoretically I could create the machine-id file beforehand. But
when putting my image onto 50+ devices, I want to have one identical
image that I deploy, that I can check via SHA1 ...


More information about the systemd-devel mailing list