<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey,<br>
<br>
Some other topic related to "empty /etc" discussions: when preparing
some generic distro images, we are have the desire to ensure that
all new instances will get a different /etc/machine-id file.<br>
As part of the empty /etc at boot, we first thought that removing
/etc/machine-id would be sufficient, however, the instance then
doesn't generate a new machine-id file and complain heavily.<br>
<br>
The new debug message of systemd 216+ helped shading some lights on
it:
<a class="moz-txt-link-freetext" href="http://cgit.freedesktop.org/systemd/systemd-stable/diff/src/core/machine-id-setup.c?h=v216-stable&id=896050eeb3acbf4106d71204a5173b4984cf1675">http://cgit.freedesktop.org/systemd/systemd-stable/diff/src/core/machine-id-setup.c?h=v216-stable&id=896050eeb3acbf4106d71204a5173b4984cf1675</a>,
and adding debug statement in machine_id_setup() from
src/core/machine-id-setup.c just beforeĀ
<meta http-equiv="content-type" content="text/html; charset=utf-8">
"open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444)"
explains what happens with /proc/mounts:<br>
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">[ 2.119041] systemd[1]: rootfs / rootfs rw
[ 2.126775] systemd[1]: /dev/disk/by-uuid/ec8166e5-d5ed-45ec-b350-6cf5773904ac / ext4 ro,relatime,data=ordered
</pre>
<br>
It's clear then that at this stage of the boot process / is
readonly.<br>
The error message (and code) will say that in this case, what is
supported is an empty /etc/machine-id. After reboot, the consequence
is that /etc/machine-id is mounted as a tmpfs:<br>
<br>
tmpfs on /etc/machine-id type tmpfs
(ro,relatime,size=204948k,mode=755)<br>
<br>
However, this means is that each boot of this instance will result
in a different machine-id, which isn't what is desired in the empty
/etc case after a factory reset. I know that there is the utility
systemd-machine-id-setup that we are running on systemd postinst in
debian/ubuntu, but that doesn't cover the factory reset one.<br>
<br>
Is there anything obvious that I'm missing to cover that case or
anything in the pipe?<br>
Cheers,<br>
Didier<br>
</body>
</html>