From: Daan De Meyer Date: Wed, 30 Mar 2022 07:58:15 +0000 (+0200) Subject: Reuse machine ID when re-using a cached image X-Git-Tag: v13~58^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F942%2Fhead;p=thirdparty%2Fmkosi.git Reuse machine ID when re-using a cached image 4fb53aea9e04b931cccedf1545831e426d6ec2f7 broke incremental builds for bootable Fedora images because when building the cached image, the initrd is installed to "/efi//...", and when doing a cached build, a new machine ID is generated inside mkosi (but not written to /etc/machine-id), making gen_kernel_images() unable to find the initrd. Let's fix the issue by re-using the machine ID from /etc/machine-id when doing a cached build. In the future, we can use the new entry-token feature of bootctl to have kernel-install write to directory in /efi that's not tied to the machine ID but until that's widely available this will have to do. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ed9d54923..611881067 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1683,6 +1683,8 @@ def root_home(args: MkosiArgs, root: Path) -> Path: def prepare_tree(args: MkosiArgs, root: Path, do_run_build_script: bool, cached: bool) -> None: if cached: + # Reuse machine-id from cached image. + args.machine_id = uuid.UUID(root.joinpath("etc/machine-id").read_text().strip()).hex return with complete_step("Setting up basic OS tree…"):