[systemd-devel] Host and machine ids are equal (4c93d957bcf44b289c3e4edb5bd5c355): refusing to link journals

Ruben Kerkhof ruben at rubenkerkhof.com
Mon Apr 28 08:45:11 PDT 2014


On Mon, Apr 28, 2014 at 5:07 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Sat, 26.04.14 15:35, Ruben Kerkhof (ruben at rubenkerkhof.com) wrote:
>
>> Hi list,
>>
>> I was just playing with systemd-nspawn, and noticed that when I start a container in a virtual machine running on KVM,
>> it gets the same machine-id as the vm itself, resulting in:
>> Host and machine ids are equal (4c93d957bcf44b289c3e4edb5bd5c355): refusing to link journals
>>
>>  Is this by design, or is this a bug?
>
> How did you create the container tree? Did you copy the host's root into
> a subdirectory? Note that you need to make sure that /etc/machine-id is
> unique. When you copy the same image into multiple directories you hence
> need to regenerate the machine-id.

I used pacstrap on Arch to create the tree, as described in
https://wiki.archlinux.org/index.php/Arch_systemd_container
After running 'pacstrap -i -c -d ~/testcontainer base'
~/testcontainer/etc/machine-id is indeed a copy of /etc/machine-id on
the host.
I'm not sure how it gets there yet, looking into it...

>
> Alternatively, remove the file in the container, as it will then create
> a new machine id on boot automatically, and store in the file.

Tried that, it does generate a machine-id, but the same one as on the host.

[ruben at vm ~]$ sudo rm testcontainer/etc/machine-id
[ruben at vm ~]$ sudo systemd-nspawn -bD ~/testcontainer

And on the third line, the boot output shows:
Initializing machine ID from KVM UUID.

Looking at the code in machine-id-setup.c:generate, it seems that it
first checks if we're running in a kvm vm, and only if that's not the
case, if we're running in a container.

>
> Lennart

Kind regards,

Ruben


More information about the systemd-devel mailing list