Clear disk signatures before archinstall wipes the target - #138
Open
mp-c0de wants to merge 1 commit into
Open
Conversation
The full-disk cleanup released holders but never removed anything written on the disk, so a previous install's LUKS header reached archinstall intact. Archinstall's own per-partition wipefs --all was the first command to touch it, and when that failed the install aborted mid-run after the user had already asked for the whole disk to be erased. Wipe each partition's signatures and then the disk's own, which takes the GPT, its backup header and the PMBR with it. Only the wipe path reaches this script, so the whole disk is in scope by construction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #137.
A Full Install / erase the entire disk onto a drive that already held a LUKS partition aborted during Installing Arch + Omarchy, with archinstall raising a
SysCallErrorwhen/usr/bin/wipefs --all /dev/sda2exited 1. Runningwipefs -a /dev/sdaby hand from the recovery shell and re-running the identical install made it succeed.Cause
omarchy-iso-cleanup-diskunmounts,swapoffs, deactivates LVM, closes open crypt mappings, then flushes and re-reads the table. All of that releases holders; none of it removes anything written on the disk. A LUKS header on an unopened partition is not a holder, so nothing in the cleanup touches it, and archinstall's own per-partitionwipefs --allbecomes the first command to meet a stale header — mid-install, where failing is expensive.The net effect is that "wipe the entire disk" is never carried out by our own code. It is delegated to archinstall's per-partition wipe, which is the fragile path; the manual whole-disk
wipefs -aworks because it addresses the disk instead.Change
After the existing holder-release loops,
wipefs -afeach partition and then the disk. Partitions first, because the table is what makes the child nodes addressable — taking the disk first would strand the old headers in space nothing can name. Failures are tolerated on purpose: the whole-disk wipe that follows takes the GPT, its backup header and the PMBR with it, which is what makes a partition whose own wipe just failed stop existing. That is the manual recovery step, done for the user this time.No new dependency.
wipefsis util-linux and is demonstrably on the medium, since archinstall's own call to it is what fails.This cannot reach a disk the user did not ask to erase. The orchestrator skips cleanup entirely when
ctx.is_protected, and_install_disk()returns a device only when its modification carrieswipe: true(phases_impl.py:180-193), so dual-boot, protected and pre-mounted installs never call it.Verification
On a loop-backed disk built to the same shape as the reported failure — GPT, vfat
p1, LUKS2p2— under Debian with util-linux 2.38.1 and cryptsetup 2.6.1.Before, the cleanup reports success and changes nothing:
After:
Both LUKS2 headers, both GPT copies and the PMBR are gone, and the disk is empty — the same end state as the manual workaround.
Also checked, all unchanged: the script stays idempotent (three consecutive runs, including against a bare disk with no table, exit 0),
--protectedmode still returns before any of this, and both argument guards still exit 1../test/allbehaves identically before and after this branch on my machine. One case, "the failure screen shows the diagnosis", fails in both — it needsgum, which isn't installed here — so it is a local environment gap, not a regression.Not added: a unit test.
test/allis deliberately VM-free and unprivileged, and the only honest test of this code needs a real block device — a stubbed one would have to name a real disk to satisfy the script's[[ -b $disk ]]guard, and if the stubbing ever broke it would runwipefsagainst the developer's own drive. The reproduction above is scripted and I'm happy to contribute it undertest/integration.d/instead if you'd like it there.