The drive wizard never offers an EFI system partition

On a Debian install the onboarding wizard offered the EFI system partition
(unlabeled vfat at /boot/efi) as the primary WROLPi drive; choosing it would
mount the boot partition over /media/wrolpi.  Candidates were filtered by
the "EFI" label only, and the Debian installer leaves the ESP unlabeled.

/boot/efi is now an excluded mountpoint, and partitions with the EFI system
partition type (GPT GUID or MBR 0xef, from lsblk PARTTYPE) are excluded even
when unmounted, e.g. on a second internal disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-10-14 16:21:50 -06:00
parent 80678e1f6e
commit 4b84a4d6d4
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 68 additions and 2 deletions

View file

@ -48,6 +48,7 @@ class BlockDevice:
uuid: Optional[str]
model: Optional[str]
is_wrolpi_drive: bool = False
parttype: Optional[str] = None # GPT type GUID, or MBR type like "0xef".
def get_block_devices() -> list[BlockDevice]:
@ -60,7 +61,7 @@ def get_block_devices() -> list[BlockDevice]:
if is_docker_mode():
return []
cmd = ["lsblk", "-J", "-o", "NAME,PATH,SIZE,TYPE,FSTYPE,MOUNTPOINT,LABEL,UUID,MODEL"]
cmd = ["lsblk", "-J", "-o", "NAME,PATH,SIZE,TYPE,FSTYPE,MOUNTPOINT,LABEL,UUID,MODEL,PARTTYPE"]
try:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=10)
@ -83,6 +84,7 @@ def get_block_devices() -> list[BlockDevice]:
label=dev.get("label"),
uuid=dev.get("uuid"),
model=dev.get("model") or parent_model,
parttype=dev.get("parttype"),
))
# Process children (partitions)
for child in dev.get("children", []):

View file

@ -36,11 +36,15 @@ logger = logging.getLogger(__name__)
TEMP_MOUNT_PATH = "/media/wrolpi_temp_onboarding"
# System mountpoints that should never be candidates
EXCLUDED_MOUNTPOINTS = {"/", "/boot", "/boot/firmware"}
EXCLUDED_MOUNTPOINTS = {"/", "/boot", "/boot/efi", "/boot/firmware"}
# Partition labels that should never be candidates (case-insensitive)
EXCLUDED_LABELS = {"efi", "efi system partition"}
# EFI system partition types (GPT GUID, MBR id); these partitions are often
# unlabeled, so the label check alone misses them.
EFI_PARTTYPES = {"c12a7328-f81f-11d2-ba4b-00a0c93ec93b", "0xef"}
def get_onboarding_candidates() -> list[dict]:
"""
@ -65,6 +69,8 @@ def get_onboarding_candidates() -> list[dict]:
# Skip EFI system partitions
if d.label and d.label.lower() in EXCLUDED_LABELS:
continue
if d.parttype and d.parttype.lower() in EFI_PARTTYPES:
continue
candidates.append({
"path": d.path,
"name": d.name,