From 5cae3c5a5a8bd1447c295b0a2076ae2709a0fcb0 Mon Sep 17 00:00:00 2001 From: "Gary T. Giesen" Date: Wed, 24 Jun 2026 09:32:52 -0400 Subject: [PATCH] partitioning: Fix udev race in full_disk_format; fail on format errors Each parted invocation triggers a partition-table rescan during which udev removes and recreates the partition device nodes. On EFI installs (three partitions, plus a trailing 'set 1 boot on') mkfs.ext4 raced a vanishing /dev/vda3: the existence check passed, mke2fs then found no node, and because the failure was tolerated the root mount silently failed and rsync copied the entire system into the live session's tmpfs until ENOSPC. Run 'udevadm settle' before the node-existence check, and raise on a non-zero mkfs exit instead of carrying on with an unformatted target. --- usr/lib/live-installer/partitioning.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr/lib/live-installer/partitioning.py b/usr/lib/live-installer/partitioning.py index 4cc429dd..ad6700b1 100644 --- a/usr/lib/live-installer/partitioning.py +++ b/usr/lib/live-installer/partitioning.py @@ -470,6 +470,10 @@ def full_disk_format(device, create_boot=False, create_swap=True): partition_path = "%s%s%d" % (device.path, partition_prefix, partition_number) num_tries = 0 while True: + # Each parted invocation triggers a partition-table rescan; + # udev briefly removes and recreates the device nodes. Wait + # for it to finish or mkfs can race a vanishing node. + os.system("udevadm settle 2>/dev/null") if os.path.exists(partition_path): break if num_tries < 5: @@ -481,7 +485,11 @@ def full_disk_format(device, create_boot=False, create_swap=True): raise Exception(_("The partition %s could not be created. The installation will stop. Restart the computer and try again.") % partition_path) mkfs = mkfs.format(partition_path) print(mkfs) - os.system(mkfs) + if os.system(mkfs) != 0: + # A failed format must stop the installation here: if this is + # tolerated, mounting fails silently and the file copy lands + # in the live session's tmpfs until it fills up. + raise Exception(_("The partition %s could not be formatted. The installation will stop. Restart the computer and try again.") % partition_path) start_mb += size_mb + 1 if installer.setup.gptonefi: run_parted('set 1 boot on')