All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit b639e7f1 authored by David Johnson's avatar David Johnson

Force a regeneration of /etc/machine-id in prepare for systemd-based OSes.

(Also link the dbus machine-id file to the one systemd will generate on
the next boot.  This seems safe and correct.)

Certain things (like systemd's dhcp client) use the machine-id as a seed
for derived values.  For instance, systemd's dhcp client offers a
ClientIdentifier in the new client style, and some servers will return
the same address to *all* requesting clients, instead of returning only
based on source MAC.  Can't have any of that confusion.
parent 6e0d37ee
......@@ -539,6 +539,24 @@ for my $pdir (@PHOOKSDIRS) {
}
}
#
# Get set up to force a regeneration of the system machine-id. This
# should be done last; it can make the system unstable; see man
# dbus-uuidgen. We only do this if we've got a dbus-uuidgen. NB:
# systems are theoretically supposed to regen /etc/machine-id if it's
# not present, but this doesn't happen on Ubuntu 18, for instance (see
# also https://bugzilla.redhat.com/show_bug.cgi?id=1379800).
# Fortunately, if the file is present and empty, it does get
# regenerated. So we empty it, and ensure that /var/lib/dbus/machine-id
# is a symlink to /etc/machine-id.
#
if (-e "/etc/machine-id" && -e "/var/lib/dbus/machine-id") {
open(FD,">/etc/machine-id");
close(FD);
system("ln -sf /etc/machine-id /var/lib/dbus/machine-id");
print "Forcing regeneration of machine-id on next boot.\n";
}
# Leave this print statement here; create_image depends on it.
print "prepare ran successfully!\n";
exit 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment