[systemd-devel] no installed machine-id vs systemd-in-initramfs

Harald Hoyer harald.hoyer at gmail.com
Thu Jul 11 03:14:38 PDT 2013

On 07/11/2013 12:04 PM, Kay Sievers wrote:
> On Thu, Jul 11, 2013 at 11:55 AM, Harald Hoyer <harald.hoyer at gmail.com> wrote:
>> On 07/10/2013 05:26 PM, Colin Walters wrote:
>>> The gnome-ostree build system generates disk images that can be
>>> downloaded directly; there is no installer.
>>> In the old model of "dracut shell script + systemd", systemd's main.c
>>> has:
>>> if (arg_running_as == SYSTEMD_SYSTEM ...) {
>>>   ...
>>>   machine_id_setup();
>>>   ...
>>> }
>>> So after mounting the rootfs, we'd end up writing one to /etc (at least
>>> in gnome-ostree which comes with a writable copy of /etc), and it would
>>> persist across reboots, and all would be well with the world.
>>> In the new systemd-in-initramfs model, journald is now launched in the
>>> initramfs.  Dracut will copy the host's machine id into the initramfs
>>> if it exists, but in the gnome-ostree case (or more generally
>>> "pre-canned OS" case), there isn't one.  journald will attempt to start,
>>> and fail.
>>> One thought I had is to say:  If there's no /etc/machine-id in the
>>> initramfs, write one to /run/machine-id.  After mounting the rootfs,
>>> persist that to /etc.
>> Err, if there is no machine-id in the initramfs, systemd and journald should do
>> just fine.
>> It was this way in F18, F17.
> Didn't it always need an empty file to over-mount it with a temporary
> and randomly created one?
> Kay

To quote from the dracut install script:

    if [[ $hostonly ]]; then
        dracut_install -o \
        if ! [[ -e "$initdir/etc/machine-id" ]]; then
            > "$initdir/etc/machine-id"

Yes, you are right. In the hostonly case, there is no empty machine-id created,
if it is missing on the running machine.

Will fix.

More information about the systemd-devel mailing list