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

Kay Sievers kay at vrfy.org
Fri Dec 27 07:30:33 PST 2013


On Fri, Dec 27, 2013 at 4:02 PM, Holger Schurig <holgerschurig at gmail.com> wrote:
> Maybe sd_id128_get_machine() could try first to read /etc/machine-id
> and use that. If it doesn't exist, it could read /run/machine-id and
> use that. If that doesn't exist we're doomed *)

It's a simple defined 3rd party file API, not rules other than open()
should be applied.

This could work:
  - place an empty file in /etc/machine-id
  - systemd will create a random id and mount it over the empty file
  - you mount the root device a second time at /run/foo
  - you replace the *content* (not the inode) of /run/foo/etc/machine-id
    with the content of /etc/machine-id
  - with the next reboot, the content should be persistent and identical

Kay


More information about the systemd-devel mailing list