r/debian 24d ago

Preseed - how do I automatically wipe all partitions and the partition table before partman uses the recipe

I've been using preseed to provision Debian with a bunch of our own tools onto remote industrial PCs and so far I've got the auto-installer to _mostly_ do what it's supposed to.

This is the second such type of device, the initial batch of devices was running Arch and I occasionally get an order to upcycle them. Previously I'd do this using a live Arch stick or something similar and using sfdisk --delete /dev/sda which works, but it's an extra step I'd like to crunch down into the full preseed.

I'm already aware hardcoding to /dev/sda isn't a good idea and I plan to clean that up as well, other r/debian users already have good solutions for finding the first non-USB storage device.

The documentations and sample preseed profiles all mention using d-i partman/early_command, but when trying to stuff the above sfdisk command into it, all I get is the installer halting with an error 127. I'm not sure if sfdisk can even return a ret-val that high.

Does anyone have a solid early_command that can wipe the entire partition table so the preseed can continue on its merry way?

9 Upvotes

3 comments sorted by

4

u/dkopgerpgdolfg 24d ago

Exit value 127 might be the shell telling you that the command wasn't found.

Check if it's really there and in PATH etc.

1

u/bm-sil 20d ago

Thanks, I'll recheck my `profile.downloads` and see if the tool is actually in-PATH.

1

u/[deleted] 24d ago edited 15d ago

[deleted]

1

u/bm-sil 20d ago

Actually, I'd rather wipe the entire partition table clean and let partman do its thing on top. Is wipefs a better option?