From bacc2d04ca8533243aaf57800cd4465ab1f3385a Mon Sep 17 00:00:00 2001 From: BreezeDelegate <271538431+BreezeDelegate@users.noreply.github.com> Date: Mon, 24 Aug 2026 14:13:11 +0000 Subject: [PATCH 1/2] Fix USB format synchronization --- lib/raw_format.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/raw_format.py b/lib/raw_format.py index e5c1668..d3ea0a9 100755 --- a/lib/raw_format.py +++ b/lib/raw_format.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -from subprocess import call +from subprocess import check_call import sys import argparse sys.path.append('/usr/lib/mintstick') @@ -9,8 +9,8 @@ def execute(command): syslog.syslog(str(command)) - call(command) - call(["sync"]) + check_call(command) + check_call(["sync"]) def raw_format(device_path, fstype, volume_label, uid, gid): @@ -36,6 +36,10 @@ def raw_format(device_path, fstype, volume_label, uid, gid): # If it starts at 0% or 0MB, it's not aligned to MB's and complains execute(["parted", device_path, "mkpart", "primary", partition_type, "1MiB", "100%"]) + # Make sure the kernel and udev see the new partition geometry before formatting it. + execute(["partprobe", device_path]) + execute(["udevadm", "settle", "--timeout=10", "--exit-if-exists=%s" % partition_path]) + # Call wipefs on the new partitions to avoid problems with old filesystem signatures execute(["wipefs", "-a", partition_path, "--force"]) From a232a2d22425dccc4a87de0f92b5e341951c35c3 Mon Sep 17 00:00:00 2001 From: BreezeDelegate <271538431+BreezeDelegate@users.noreply.github.com> Date: Thu, 12 Nov 2026 21:11:27 +0100 Subject: [PATCH 2/2] Keep partition table refresh without udev wait --- lib/raw_format.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/raw_format.py b/lib/raw_format.py index d3ea0a9..3247ac9 100755 --- a/lib/raw_format.py +++ b/lib/raw_format.py @@ -36,9 +36,8 @@ def raw_format(device_path, fstype, volume_label, uid, gid): # If it starts at 0% or 0MB, it's not aligned to MB's and complains execute(["parted", device_path, "mkpart", "primary", partition_type, "1MiB", "100%"]) - # Make sure the kernel and udev see the new partition geometry before formatting it. + # Reload the new partition table before formatting. execute(["partprobe", device_path]) - execute(["udevadm", "settle", "--timeout=10", "--exit-if-exists=%s" % partition_path]) # Call wipefs on the new partitions to avoid problems with old filesystem signatures execute(["wipefs", "-a", partition_path, "--force"])