From e78ddb03e1bbc46e59fd6a9889699b12808d0fec Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Fri, 28 Apr 2023 22:18:48 +1000 Subject: Attempt to fetch partuuid multiple times (#1770) * Attempt to fetch partuuid multiple times * Update --------- Co-authored-by: Daniel Girtler --- archinstall/lib/disk/device_handler.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index 12cf18ea..ba325cda 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -341,16 +341,35 @@ class DeviceHandler(object): # the partition has a real path now as it was created part_mod.dev_path = Path(partition.path) - info = get_lsblk_info(part_mod.dev_path) - - if not info.partuuid: - raise DiskError(f'Unable to determine new partition uuid: {part_mod.dev_path}') + info = self._fetch_partuuid(part_mod.dev_path) part_mod.partuuid = info.partuuid part_mod.uuid = 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: + attempts = 3 + info: Optional[LsblkInfo] = None + + self.partprobe(path) + for attempt_nr in range(attempts): + time.sleep(attempt_nr + 1) + info = get_lsblk_info(path) + + if info.partuuid: + break + + self.partprobe(path) + + if not info or not info.partuuid: + log(f'Unable to determine new partition uuid: {path}\n{info}', level=logging.DEBUG) + raise DiskError(f'Unable to determine new partition uuid: {path}') + + log(f'partuuid found: {info.json()}', level=logging.DEBUG) + + return info + def create_btrfs_volumes( self, part_mod: PartitionModification, @@ -555,12 +574,13 @@ class DeviceHandler(object): command = 'partprobe' try: + log(f'Calling partprobe: {command}', level=logging.DEBUG) result = SysCommand(command) + if result.exit_code != 0: - log(f'Error calling partprobe: {result.decode()}', level=logging.DEBUG) - raise DiskError(f'Could not perform partprobe on {path}: {result.decode()}') + log(f'"{command}" returned a failure: {result.decode()}', level=logging.DEBUG) except SysCallError as error: - log(f"partprobe experienced an error with {path}: {error}", level=logging.DEBUG) + log(f'"{command}" failed to run: {error}', level=logging.DEBUG) def _wipe(self, dev_path: Path): """ -- cgit v1.2.3-70-g09d2