From: Michael A Cassaniti Date: Mon, 18 Jul 2022 03:55:12 +0000 (+1000) Subject: Explicitly adding partition after creating X-Git-Tag: v14~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3851ec1a16f2500ec599906f8b24ff473e922c92;p=thirdparty%2Fmkosi.git Explicitly adding partition after creating This resolves an exception when the partition is explicitly removed later --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index d13a31453..1f3b93957 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3954,6 +3954,15 @@ def insert_partition( with complete_step(f"Inserting partition of {format_bytes(part_size)}{ss}..."): args.partition_table.run_sfdisk(loopdev) + # Required otherwise the partition removal will fail + with open(loopdev, 'rb+') as f: + ioctl_partition_add( + f.fileno(), + part.number, + args.partition_table.partition_offset(part), + args.partition_table.partition_size(part) + ) + with complete_step("Writing partition..."): if ident == PartitionIdentifier.root: luks_format_root(args, loopdev, False, False, True)