Commit 994751f2 authored by segfault's avatar segfault
Browse files

Don't use buggy udisks method to set GPT flags (refs: #16168)

parent f63a0faa
......@@ -102,10 +102,6 @@ class ImageCreator(object):
self.create_gpt()
self.create_partition()
self.set_partition_flags()
# set_partition_flags() resets the partition type
# before Buster's udisks2 + libblockdev 2.15-1
# (https://github.com/storaged-project/udisks/issues/418)
self.set_partition_type()
# XXX: Rescan?
self.format_partition()
with self.mount_partition():
......@@ -187,38 +183,11 @@ class ImageCreator(object):
self._partition = partition
def set_partition_flags(self):
logger.info("Setting partition flags")
start_time = time.perf_counter()
while time.perf_counter() - start_time < WAIT_FOR_PARTITION_TIMEOUT:
try:
self.partition.props.partition.call_set_flags_sync(
arg_flags=SYSTEM_PARTITION_FLAGS,
arg_options=GLib.Variant('a{sv}', None)
)
except GLib.Error as e:
if "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface" in e.message:
time.sleep(0.1)
continue
raise
return
def set_partition_type(self):
logger.info("Setting partition type")
start_time = time.perf_counter()
while time.perf_counter() - start_time < WAIT_FOR_PARTITION_TIMEOUT:
try:
self.partition.props.partition.call_set_type_sync(
ESP_GUID,
GLib.Variant('a{sv}', None)
)
except GLib.Error as e:
if "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface" in e.message:
time.sleep(0.1)
continue
raise
return
# We use sgdisk directly instead of udisks' set_flags method, because the
# latter sometimes resets the partition type / partition table type
# before Buster's udisks2 + libblockdev 2.15-1
# (https://github.com/storaged-project/udisks/issues/418)
execute(["/sbin/sgdisk", "--attributes=1:=:%x" % SYSTEM_PARTITION_FLAGS, self.image])
def format_partition(self):
logger.info("Formatting partition")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment