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

Holger Schurig holgerschurig at gmail.com
Fri Dec 27 04:44:22 PST 2013


If I place an empty /etc/machine-id into the image, then
/run/machine-id will be bind-mounted over it.

But that file will be different whenever I boot. So obviously I want
to save it, once my filesystem is fsck'd and mounted read-write. But
if I do it like that ...

umount /etc/machine-id
cp /run/machine-id /etc/machine-id

... then and between step 1 and 2 some other process might fall on
it's nose. I noticed that several systemd binaries directly access
/etc/machine-id via sd_id128_get_machine(). That would mean a race
condition, or?



> You should always mount a tmpfs as /run, it is not supposed to be the
> same as /. Omitting the /run tmpfs mount is not supported.

Kay, you're replaying to my point 3. that I already have "taken back"
:-)   And no, I should *NOT* mount it --- how could I, without an
initrd?  I don't need to mount it, because systemd mounts it for me
with one of the functions in src/core/mount-setup.c before calling
machine_id_setup().


More information about the systemd-devel mailing list