LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
56 stars 6 forks source link

[administration][init] Reset machine-d #477

Open LukeShortCloud opened 3 years ago

LukeShortCloud commented 3 years ago

Nest this under systemd and machine-id headers.

""" Some Linux network services, such as systemd-network, use the machine-id for DHCP. This means that two instances of Mac Linux Gaming Stick with the same machine-id (as it is today) will have a conflict as both will get DHCP for the same IP address. We need to reset this.

$ echo -n | sudo tee /etc/machine-id
$ sudo rm -f /var/lib/dbus/machine-id
$ sudo ln -s /etc/machine-id /var/lib/dbus/machine-id

By default, systemd will regenerate the machine-id on the next boot.

https://kb.vmware.com/s/article/82229

See also: https://unix.stackexchange.com/questions/402999/is-it-ok-to-change-etc-machine-id """

https://github.com/ekultails/mac-linux-gaming-stick/issues/98

LukeShortCloud commented 3 years ago

The /etc/machine-id file should be world-readable and not writeable.

$ sudo chmod 0444 /etc/machine-id
LukeShortCloud commented 3 years ago

For virtual machines, run all default operations except for the customize which will (1) set a random seed and (2) set the /etc/machine-id.

$ sudo virt-sysprep --operations defaults,-customize -a <IMAGE>

OR run all operations and then truncate the /etc/machine-id file.

$ sudo virt-sysprep --truncate /etc/machine-id -a <IMAGE>

https://bugzilla.redhat.com/show_bug.cgi?id=1557042

LukeShortCloud commented 3 years ago

Related: you can run all operations (not just the default) by running virt-sysprep --operations all.