Cloning of linux machines and machine id

Hello

We have cloning multiple rocky machines, without dealing with the machine id. These machines are in labs, acting as nfs clients with sssd configuration etc.
Can this cause any problems ? Should we regenerate the machine id on the machines?

Thank you

M.

In certain situations it can cause problems when the machine-id is the same on each of the machines. I’ve known it to cause problems with Red Hat Satellite, when machines registered with Satellite conflict with each other.

Whether it will cause problems or not with sssd I have no idea, but from personal experience I always make sure that my machines have individual machine-id’s.

The question is who/what does use the ID? While they seem likely to be within the machine, the above example shows that there could be exceptions.


I prefer fresh installs followed by dropping identical configuration with Ansible playbooks. (The plays do not touch things that should remain unique.) On clouds I’ve seen “clone” option, but I do assume that it and/or cloud-init there does individualize the clones on install.


By what procedure?

The man machine-id notes:

systemd-machine-id-setup(1) may be used by installer tools to initialize the machine ID at install time, but /etc/machine-id may also be written using any other means.

systemd-firstboot(1) may be used to initialize /etc/machine-id on mounted (but not booted) system images.

and

The machine ID may be set, for example when network booting, with the systemd.machine_id= kernel command line parameter

You will find the machine has a file called /etc/machine-id, a symlink to this is found under /var/lib/dbus/ (on Rocky 8, on Rocky 9 I don’t have) therefore the procedure would be:

rm /etc/machine-id
dbus-uuidgen --ensure=/etc/machine-id

this I have used from Red Hat documentation when I had the problem previously and googled it. From a quick demo on my machine:

root@rocky9:~# cat /etc/machine-id 
4cafd3ca1b574eee83e0ebb12ce8403a

root@rocky9:~# dbus-uuidgen --ensure=/etc/machine-id

root@rocky9:~# cat /etc/machine-id 
2cf73ce81573c61d8bacfd6b670681c5

a reboot would be recommended too.

EDIT:

There is a systemd procedure for it here: How to reconfigure the machine-id? - Red Hat Customer Portal

systemd-machine-id-setup

so will probably work instead of the dbus method. It also suggests also updating grub:

root@rocky9:/boot# systemd-machine-id-setup 
Initializing machine ID from random generator.

root@rocky9:/boot# cat /etc/machine-id 
b126350a4c894057b8da42c07f7620d8

root@rocky9:/boot# grub2-mkconfig --update-bls-cmdline -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
1 Like