[pve-devel] [PATCH installer v2 1/2] fix #1603: create a new and unique machine-id

Stoiko Ivanov s.ivanov at proxmox.com
Tue Jul 9 18:09:18 CEST 2019


see machine-id(5). The machine-id serves as a partial replacement to the hostid
(gethostid(3)) used by systemd and should be unique.

By generating a new one with `systemd-id128 new` (see machine-id(5),
sd-id128(3)) after the installation the newly installed system gets a unique
one.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxinstall | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/proxinstall b/proxinstall
index 380abdf..97af4b9 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1510,6 +1510,10 @@ sub extract_data {
 	diversion_add($targetdir, "/usr/sbin/update-grub", "/bin/true");
 	diversion_add($targetdir, "/usr/sbin/update-initramfs", "/bin/true");
 
+	my $machine_id = run_command("systemd-id128 new");
+	die "unable to create a new machine-id\n" if ! $machine_id;
+	write_config($machine_id, "$targetdir/etc/machine-id");
+
 	syscmd("touch  $targetdir/proxmox_install_mode");
 
 	my $grub_install_devices_txt = '';
-- 
2.20.1





More information about the pve-devel mailing list