[systemd-devel] /etc/machine-id handling in a non-initrd / embedded environment ?!?!
Holger Schurig
holgerschurig at gmail.com
Fri Dec 27 03:04:13 PST 2013
I was in error about this:
> 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 !
When there is no writable or readable /etc/machine-id, then it won't
even try to generate one, as this code here bails out with a "return
-errno;":
fd = open("/etc/machine-id",
O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
if (fd >= 0)
writable = true;
else {
fd = open("/etc/machine-id",
O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0) {
log_error("Cannot open /etc/machine-id: %m");
return -errno;
}
writable = false;
}
More information about the systemd-devel
mailing list