Didier Roche
2014-11-19 08:45:16 UTC
Hey,
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.
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.
The new debug message of systemd 216+ helped shading some lights on it:
http://cgit.freedesktop.org/systemd/systemd-stable/diff/src/core/machine-id-setup.c?h=v216-stable&id=896050eeb3acbf4106d71204a5173b4984cf1675,
and adding debug statement in machine_id_setup() from
src/core/machine-id-setup.c just before "open(etc_machine_id,
O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444)" explains what happens with
/proc/mounts:
[ 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
It's clear then that at this stage of the boot process / is readonly.
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:
tmpfs on /etc/machine-id type tmpfs (ro,relatime,size=204948k,mode=755)
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.
Is there anything obvious that I'm missing to cover that case or
anything in the pipe?
Cheers,
Didier
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.
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.
The new debug message of systemd 216+ helped shading some lights on it:
http://cgit.freedesktop.org/systemd/systemd-stable/diff/src/core/machine-id-setup.c?h=v216-stable&id=896050eeb3acbf4106d71204a5173b4984cf1675,
and adding debug statement in machine_id_setup() from
src/core/machine-id-setup.c just before "open(etc_machine_id,
O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444)" explains what happens with
/proc/mounts:
[ 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
It's clear then that at this stage of the boot process / is readonly.
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:
tmpfs on /etc/machine-id type tmpfs (ro,relatime,size=204948k,mode=755)
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.
Is there anything obvious that I'm missing to cover that case or
anything in the pipe?
Cheers,
Didier