Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/device_handler.py
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-09-20 14:49:29 -0400
committerGitHub <noreply@github.com>2023-09-20 20:49:29 +0200
commit3e2999bc2752c76e666d916bdb80608ad74528bf (patch)
treed4482f703e6e7281c93bcc967ad56b26cb220dfb /archinstall/lib/disk/device_handler.py
parentb1e00687953de168bbc31ea435b2c5bdc7c61e39 (diff)
Fix acquisition of UUID (#2077)
* Fix acquisition of UUID * Fix inadequate solution * Add check for UUID
Diffstat (limited to 'archinstall/lib/disk/device_handler.py')
-rw-r--r--archinstall/lib/disk/device_handler.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
index 7cd79784..a95e21e3 100644
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -291,6 +291,11 @@ class DeviceHandler(object):
else:
self._perform_formatting(part_mod.safe_fs_type, part_mod.safe_dev_path)
+ lsblk_info = self._fetch_part_info(part_mod.safe_dev_path)
+
+ part_mod.partuuid = lsblk_info.partuuid
+ part_mod.uuid = lsblk_info.uuid
+
def _perform_partitioning(
self,
part_mod: PartitionModification,
@@ -354,15 +359,10 @@ class DeviceHandler(object):
# the partition has a real path now as it was created
part_mod.dev_path = Path(partition.path)
-
- lsblk_info = self._fetch_partuuid(part_mod.dev_path)
-
- part_mod.partuuid = lsblk_info.partuuid
- part_mod.uuid = lsblk_info.uuid
except PartitionException as ex:
raise DiskError(f'Unable to add partition, most likely due to overlapping sectors: {ex}') from ex
- def _fetch_partuuid(self, path: Path) -> LsblkInfo:
+ def _fetch_part_info(self, path: Path) -> LsblkInfo:
attempts = 3
lsblk_info: Optional[LsblkInfo] = None
@@ -371,16 +371,24 @@ class DeviceHandler(object):
time.sleep(attempt_nr + 1)
lsblk_info = get_lsblk_info(path)
- if lsblk_info.partuuid:
+ if lsblk_info.partuuid and lsblk_info.uuid:
break
self.partprobe(path)
- if not lsblk_info or not lsblk_info.partuuid:
+ if not lsblk_info:
+ debug(f'Unable to get partition information: {path}')
+ raise DiskError(f'Unable to get partition information: {path}')
+
+ if not lsblk_info.partuuid:
debug(f'Unable to determine new partition uuid: {path}\n{lsblk_info}')
raise DiskError(f'Unable to determine new partition uuid: {path}')
- debug(f'partuuid found: {lsblk_info.json()}')
+ if not lsblk_info.uuid:
+ debug(f'Unable to determine new uuid: {path}\n{lsblk_info}')
+ raise DiskError(f'Unable to determine new uuid: {path}')
+
+ debug(f'partition information found: {lsblk_info.json()}')
return lsblk_info