[systemd-devel] How to factory reset?

Lennart Poettering lennart at poettering.net
Wed Apr 22 08:41:50 PDT 2015


On Fri, 13.03.15 14:20, Tobias Hunger (tobias.hunger at gmail.com) wrote:

> Hi Zbyszek,
> 
> I would expect the machine-id to be written before mount units are
> processed, so for that to work I would need to mount /var in the
> initrd, wouldn't I?

Yeah, /var/lib/dbus/machine-id isn't a general purpose solution, since
/var ca nbe mounted very late. (Also, as mentioned in other mail, it's
compat only, please don't use it.)

> Currently I am trying to just write the machine-id to /etc in the
> initrd. This makes systemd loose the understanding that /etc is empty
> though, which might have some side-effects that I am not yet
> anticipating.
> 
> Isn't systemd started from inside the initrd once the new root has
> been set up? Maybe I could set $container_uuid and feed the machine-id
> to systemd that way? I am afraid that this will lead to some other
> side-effects, because systemd might assume to be running inside a
> container. Looks like I will have to do some testing over the
> weekend:-)

$container_uuid is only used in containers. If you set it in other
conditions, we don't care.

> Maybe I am lucky and /sys/class/dmi/id/product_uuid is set.

That is only read on kvm, since on physical hardware it is more often
than not filled with rubbish, that is not useful as a real machine id.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list