Skip to content

fix: skip deleted partitions when wiping signatures and encrypting - #4853

Open
Kolgrim33 wants to merge 1 commit into
archlinux:masterfrom
Kolgrim33:fix/manual-partitioning-delete-wipefs
Open

Kolgrim33 wants to merge 1 commit into
archlinux:masterfrom
Kolgrim33:fix/manual-partitioning-delete-wipefs

Conversation

@Kolgrim33

Copy link
Copy Markdown

PR Description:

When using manual partitioning without wiping the whole disk (wipe=False), deleting an existing partition sets its status to ModificationStatus.DELETE while retaining its dev_path. Because PartitionModification.exists() only checks status == ModificationStatus.EXIST, filtering with [p for p in modification.partitions if not p.exists()] also includes DELETE entries.

After disk.commit() removes the deleted partition's device node, the signature-wipe loop in DeviceHandler.partition() ran wipefs --all against the removed device node, crashing the installation with SysCallError.

Similarly, FilesystemHandler._encrypt_partitions() and select_partitions_to_encrypt() filtered with not p.exists() instead of p.is_create_or_modify(), and _encrypt_partitions() reset enc_mods = {} inside the device_modifications loop.

This PR:

  • Checks part_mod.is_create_or_modify() before running wipefs --all in DeviceHandler.partition().
  • Uses p.is_create_or_modify() in FilesystemHandler._encrypt_partitions() (matching _format_partitions()) and select_partitions_to_encrypt().
  • Removes the redundant enc_mods = {} reset inside the device_modifications loop in _encrypt_partitions().
  • Adds unit tests in tests/test_disk_partitioning.py.

Fixes #4849

Tests and Checks

  • I have tested the code!

When using manual partitioning without wiping the whole disk, deleting
an existing partition marks it with ModificationStatus.DELETE while
keeping its previous dev_path. Because PartitionModification.exists()
only checks for ModificationStatus.EXIST, [p for p in partitions if not
p.exists()] also includes deleted partitions.

After disk.commit() removes the deleted partition's device node, the
signature-wipe loop in DeviceHandler.partition() attempted to run
'wipefs --all' against the removed device node, crashing the installer
with a SysCallError.

Similarly, FilesystemHandler._encrypt_partitions() and
select_partitions_to_encrypt() used 'not p.exists()' instead of
'p.is_create_or_modify()', and _encrypt_partitions() re-initialized
enc_mods inside the device_modifications loop.

Filter for is_create_or_modify() when wiping signatures, validating/
encrypting partitions, and selecting partitions to encrypt, and preserve
enc_mods across device modifications.

Fixes archlinux#4849
@Kolgrim33
Kolgrim33 requested a review from Torxed as a code owner October 25, 2026 16:45

This branch has not been deployed

No deployments
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.

Manual partitioning without wipe: deleting an existing partition crashes installer (wipefs runs on deleted partition path)

2 participants