[systemd-devel] Journalctl --list-boots problem
Lennart Poettering
lennart at poettering.net
Thu Oct 31 16:34:35 UTC 2019
On Di, 08.10.19 16:57, Martin Townsend (mtownsend1973 at gmail.com) wrote:
> Thanks for your help. In the end I just created a symlink from
> /etc/machine-id to /data/etc/machine-id. It complains really early on
> boot with
> Cannot open /etc/machine-id: No such file or directory
>
> So I guess it's trying to read /etc/machine-id for something before
> fstab has been processed and the data partition is ready.
>
> But the journal seems to be working ok and --list-boots is fine. The
> initramfs would definitely be more elegant solution to ensure
> /etc/machine-id is ready.
>
> I don't suppose you know what requires /etc/machine-id so early in the boot?
PID 1 does.
You have to have a valid /etc/machine-id really, everything else is
not supported. And it needs to be available when PID 1 initializes.
You basically have three options:
1. Make it read-only at boot, initialize persistently on OS install
2. Make it read-only, initialize it to an empty file on OS install, in
which case systemd (i.e. PID 1) overmounts it with a random one
during early boot. In this mode the system will come up with a new
identity on each boot, and thus journal files from previous boots
will be considered to belong to different systems.
2b. (Same as 2, but mount / writable during later boot, at which time
the machine ID is commited to disk automatically)
3. Make it writable during early boot, and initialize it originally to
an empty file. In this case PID 1 will generate a random one and
persist it to disk right away.
Also see:
https://www.freedesktop.org/software/systemd/man/machine-id.html
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list