From 4746b8dfd2ff3af5a15f45f2aeb650bee349dc97 Mon Sep 17 00:00:00 2001 From: dongshengyuan <545258830@qq.com> Date: Wed, 5 Aug 2026 12:15:19 +0800 Subject: [PATCH] sysupdate: honor default MatchPartitionType= for partitions sysupdate.d(5) documents linux-generic as the default MatchPartitionType= for partition targets. After 10eaca4159, omitting the option left partition_type_set false and update failed before acquiring the image. Reproducer: create a partition target transfer without MatchPartitionType= and run systemd-sysupdate update. Before: update failed with: Partition type must be set for partition targets. After: update succeeds on a linux-generic slot and installs the version, leaving the GPT label as part-v1. Follow-up for: 10eaca4159a93485054c4e7c7c35ce16114591d7 (cherry picked from commit a3ab9d2c1a604201b65789427ec914af3e0f92a2) --- src/sysupdate/sysupdate-transfer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sysupdate/sysupdate-transfer.c b/src/sysupdate/sysupdate-transfer.c index d56ab1f01ff..9f6fe74420b 100644 --- a/src/sysupdate/sysupdate-transfer.c +++ b/src/sysupdate/sysupdate-transfer.c @@ -600,6 +600,11 @@ int transfer_read_definition(Transfer *t, const char *path, const char **dirs, H return log_syntax(NULL, LOG_ERR, path, 1, SYNTHETIC_ERRNO(EINVAL), "Target Type= must be one of partition, regular-file, directory, subvolume."); + if (t->target.type == RESOURCE_PARTITION && !t->target.partition_type_set) { + t->target.partition_type = gpt_partition_type_from_uuid(SD_GPT_LINUX_GENERIC); + t->target.partition_type_set = true; + } + if ((IN_SET(t->source.type, RESOURCE_URL_FILE, RESOURCE_PARTITION, RESOURCE_REGULAR_FILE) && !IN_SET(t->target.type, RESOURCE_PARTITION, RESOURCE_REGULAR_FILE)) || (IN_SET(t->source.type, RESOURCE_URL_TAR, RESOURCE_TAR, RESOURCE_DIRECTORY, RESOURCE_SUBVOLUME) && @@ -1243,8 +1248,7 @@ int transfer_compute_temporary_paths(Transfer *t, Instance *i, InstanceMetadata if (!r) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Formatted pattern is not suitable as GPT partition label, refusing: %s", formatted_pattern); - if (!t->target.partition_type_set) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Partition type must be set for partition targets."); + assert(t->target.partition_type_set); /* Derive temporary partition type UUIDs for partial/pending states from the configured * partition type. This avoids the need for label prefixes. */