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

Holger Schurig holgerschurig at gmail.com
Fri Dec 27 07:02:12 PST 2013


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 *)

That would allow some save-code like this (quick'n'dirty & untested)

[Unit]
Description=Save machine-id
After=systemd-remount-fs.service
ConditionPathExists=!/etc/machine-id
ConditionPathExists=/run/machine-id

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=cp -a /run/machine-id /etc/machine-id



*) Note that the systemd I use (v208) will not boot if /etc/machine-id
(not even an empty one) doesn't exist. Or, maybe it boots, but because
of huge timeouts takes 20 minutes or so. So probably /run/machine-id
should always be written by machine_id_setup(), even when no empty
/etc/machine-id exists.


More information about the systemd-devel mailing list