ubuntu basefiles and machine uuid

Robert Markula robert at markula.org
Tue Jul 19 06:10:05 CEST 2022


Am 19.07.22 um 03:00 schrieb andrew bezella:
> hello -
>
> a few months ago i noticed that most of the ubuntu focal/20.04 machines
> that we had deployed were reporting the same machine id (stored in
> /etc/machine-id).  i finally circled back and it appears the issue is
> that, for an ubuntu basefile, debootstrap pulls in the dbus package
> which generates a /var/lib/dbus/machine-id file.  if this file ends up
> on the installed node, it overrides the FAI-emptied /etc/machine-id and
> results in non-unique machine ids.
>
> i've submitted a pull request[1] to exclude /var/lib/dbus/machine-id
> from the basefile but thought i should check to see if this might
> somehow be specific to our FAI configuration space/setup.  to others
> who have deployed ubuntu: are you experiencing or have you already
> worked around this issue?
>
> 1. https://github.com/faiproject/fai-config/pull/14

Yes, that one was responsible for very nasty, hard-to-spot networking 
errors with LACP (basically duplicated system IDs all over).

In scripts/DEBIAN/40-misc I commented out the following lines:

<snip>
## make sure a machine-id exists
#if [ ! -f $target/etc/machine-id ]; then
#    > $target/etc/machine-id
#fi
## recreate machine-id if the file is empty
#if [ X"$(stat -c '%s' $target/etc/machine-id 2>/dev/null)"  = X0 -a -f 
$target/bin/systemd-machine-id-setup ]; then
#    $ROOTCMD systemd-machine-id-setup
#fi
</snip>

and added these ones:

<snip>
# Ensure a new machine-id is generated under any circumstances
rm $target/etc/machine-id
rm $target/var/lib/dbus/machine-id
$ROOTCMD dbus-uuidgen --ensure=/etc/machine-id
$ROOTCMD dbus-uuidgen --ensure
</snip>

Now the machine-id is generated on-the-fly and unique on all hosts.

Cheers,


Robert


More information about the linux-fai mailing list