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

Kay Sievers kay at vrfy.org
Fri Dec 27 04:12:05 PST 2013


On Fri, Dec 27, 2013 at 11:35 AM, Holger Schurig
<holgerschurig at gmail.com> wrote:
> 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.

Just create it yourself when you compose your /.

If that image is copied to more than one box and you want it
randomized, place an empty file there.

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

Which is nothing we can fix in systemd code. It should be 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 !

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


More information about the systemd-devel mailing list