Skip to content

Commit fa82f5f

Browse files
committed
More reliably identify ESP partition
1 parent 1b89049 commit fa82f5f

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

archinstall/lib/disk/partitioning_menu.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
FilesystemType,
1111
ModificationStatus,
1212
PartitionFlag,
13+
PartitionGUID,
1314
PartitionModification,
1415
PartitionTable,
1516
PartitionType,
@@ -290,8 +291,8 @@ def handle_action(
290291
partition.mountpoint = self._prompt_mountpoint()
291292
if partition.mountpoint == Path('/boot'):
292293
partition.set_flag(PartitionFlag.BOOT)
293-
if self._using_gpt:
294-
partition.set_flag(PartitionFlag.ESP)
294+
if self._using_gpt and partition.type_uuid == PartitionGUID.ESP.bytes:
295+
partition.set_flag(PartitionFlag.ESP)
295296
case 'mark_formatting':
296297
self._prompt_formatting(partition)
297298
case 'mark_bootable':
@@ -517,9 +518,9 @@ def _create_new_partition(self, free_space: FreeSpace) -> PartitionModification:
517518

518519
if partition.mountpoint == Path('/boot'):
519520
partition.set_flag(PartitionFlag.BOOT)
520-
if self._using_gpt:
521-
partition.set_flag(PartitionFlag.ESP)
522-
elif partition.is_swap():
521+
if self._using_gpt and partition.type_uuid == PartitionGUID.ESP.bytes:
522+
partition.set_flag(PartitionFlag.ESP)
523+
if partition.is_swap():
523524
partition.set_flag(PartitionFlag.SWAP)
524525

525526
return partition

archinstall/lib/models/device_model.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def parse_arg(cls, disk_config: _DiskLayoutConfigurationSerialization) -> DiskLa
128128
device_partition = PartitionModification(
129129
status=ModificationStatus(partition['status']),
130130
fs_type=FilesystemType(partition['fs_type']) if partition.get('fs_type') else None,
131+
type_uuid=partition['type_uuid'] if partition['type_uuid'] else None,
131132
start=Size.parse_args(partition['start']),
132133
length=Size.parse_args(partition['size']),
133134
mount_options=partition['mount_options'],
@@ -480,6 +481,7 @@ class _PartitionInfo:
480481
name: str
481482
type: PartitionType
482483
fs_type: FilesystemType | None
484+
type_uuid: str | None
483485
path: Path
484486
start: Size
485487
length: Size
@@ -543,6 +545,7 @@ def from_partition(
543545
name=partition.get_name(),
544546
type=partition_type,
545547
fs_type=fs_type,
548+
type_uuid=lsblk_info.parttype,
546549
path=Path(partition.path),
547550
start=start,
548551
length=length,
@@ -755,6 +758,7 @@ class PartitionGUID(Enum):
755758
A list of Partition type GUIDs (lsblk -o+PARTTYPE) can be found here: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
756759
"""
757760
LINUX_ROOT_X86_64 = "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709"
761+
ESP = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
758762

759763
@property
760764
def bytes(self) -> bytes:
@@ -846,6 +850,7 @@ class _PartitionModificationSerialization(TypedDict):
846850
start: _SizeSerialization
847851
size: _SizeSerialization
848852
fs_type: str | None
853+
type_uuid: str | None
849854
mountpoint: str | None
850855
mount_options: list[str]
851856
flags: list[str]
@@ -860,6 +865,7 @@ class PartitionModification:
860865
start: Size
861866
length: Size
862867
fs_type: FilesystemType | None = None
868+
type_uuid: str | None = None
863869
mountpoint: Path | None = None
864870
mount_options: list[str] = field(default_factory=list)
865871
flags: list[PartitionFlag] = field(default_factory=list)
@@ -930,6 +936,7 @@ def from_existing_partition(cls, partition_info: _PartitionInfo) -> PartitionMod
930936
start=partition_info.start,
931937
length=partition_info.length,
932938
fs_type=partition_info.fs_type,
939+
type_uuid=partition_info.type_uuid,
933940
dev_path=partition_info.path,
934941
partn=partition_info.partn,
935942
partuuid=partition_info.partuuid,
@@ -1032,6 +1039,7 @@ def json(self) -> _PartitionModificationSerialization:
10321039
'start': self.start.json(),
10331040
'size': self.length.json(),
10341041
'fs_type': self.fs_type.value if self.fs_type else None,
1042+
'type_uuid': str(self.type_uuid) if self.type_uuid else None,
10351043
'mountpoint': str(self.mountpoint) if self.mountpoint else None,
10361044
'mount_options': self.mount_options,
10371045
'flags': [f.description for f in self.flags],

0 commit comments

Comments
 (0)