diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix index 5efa4e51dc06..648f2f774ddf 100644 --- a/nixos/lib/make-disk-image.nix +++ b/nixos/lib/make-disk-image.nix @@ -619,9 +619,6 @@ let format' = format; in let # __noChroot for example). export HOME=$TMPDIR NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot - - # The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images - rm -f $mountPoint/etc/machine-id ''} # Set the ownerships of the contents. The modes are set in preVM. diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py index d2ba1e54e22e..421fde5b07af 100644 --- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py +++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py @@ -159,7 +159,7 @@ def copy_from_file(file: str, dry_run: bool = False) -> str: def write_entry(profile: str | None, generation: int, specialisation: str | None, - machine_id: str, bootspec: BootSpec, current: bool) -> None: + machine_id: str | None, bootspec: BootSpec, current: bool) -> None: if specialisation: bootspec = bootspec.specialisations[specialisation] kernel = copy_from_file(bootspec.kernel) @@ -281,11 +281,7 @@ def install_bootloader(args: argparse.Namespace) -> None: except IOError as e: if e.errno != errno.ENOENT: raise - # Since systemd version 232 a machine ID is required and it might not - # be there on newly installed systems, so let's generate one so that - # bootctl can find it and we can also pass it to write_entry() later. - cmd = [f"{SYSTEMD}/bin/systemd-machine-id-setup", "--print"] - machine_id = run(cmd, stdout=subprocess.PIPE).stdout.rstrip() + machine_id = None if os.getenv("NIXOS_INSTALL_GRUB") == "1": warnings.warn("NIXOS_INSTALL_GRUB env var deprecated, use NIXOS_INSTALL_BOOTLOADER", DeprecationWarning)