Skip to content

partitioning: settle udev and abort on mkfs failure in full_disk_format - #184

Open
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:fix-partition-format-udev-race
Open

partitioning: settle udev and abort on mkfs failure in full_disk_format#184
ggiesen wants to merge 1 commit into
linuxmint:masterfrom
ggiesen:fix-partition-format-udev-race

Conversation

@ggiesen

@ggiesen ggiesen commented Jun 24, 2026

Copy link
Copy Markdown

full_disk_format() formats each new partition without waiting for udev to settle after parted's table rescan and without checking the mkfs return code, so mkfs can race a briefly-removed partition node; the silent failure later surfaces as a disk-full error when the file copy lands in the live tmpfs.

Fix:

  • Run udevadm settle before the node-existence check after each parted call. parted's rescan briefly removes and recreates the nodes; settling closes that window. No-op if udevadm is absent (stderr suppressed; falls through to the existing os.path.exists retry loop).
  • Raise if os.system(mkfs) returns non-zero — a partition that failed to format must stop the install. This mirrors the existing mklabel return-code check a few lines up.

Testing (LMDE 7, QEMU/KVM):

  • Plain and encrypted automated installs complete and boot — the settle adds no regression.
  • With mkfs.ext4 forced to fail, the install now aborts in full_disk_format() instead of silently continuing into the live tmpfs.

Split out of #180 so it can land independently.

Fixes #181

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automated install can silently fail to format the root partition and fill the live tmpfs

1 participant