[systemd-devel] Journalctl reading incorrect file

Lennart Poettering lennart at poettering.net
Fri Jan 29 14:29:57 UTC 2021


On Fr, 29.01.21 11:34, John Lane (systemd at jelmail.com) wrote:

> >
> > Is it possible you are playing some weird games with your machine ID
> > or boot ID?
> >
>
> Maybe. Yes. I have a oneshot service that writes /etc/machine-id using
> constant hardware-based info. But I've been using that for over two
> years without any issues.

Ahum. That's not supported, unless you do it before you transition to
the host. The machine ID must stay constant while the host system is
up and running. It's cached everywhere, including in PID 1 and
journald, and if you write it at some arbitrary spot this will break
all over the place. Maybe you were lucky so far, but the file should
not be changed at arbitrary times.

> The reason for settting machine id to a predictable value is because of
> a need to refer to it in scripts etc meant it needed to be known
> up-front, before the first install, but be somehow tied to the machine's
> hardware. So that's what we did.

Write it from the initrd.

You can also set it via a kernel command line option. There was also
the idea of initializing it from an env var passed to PID 1.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list