Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-04-28 22:18:48 +1000
committerGitHub <noreply@github.com>2023-04-28 14:18:48 +0200
commite78ddb03e1bbc46e59fd6a9889699b12808d0fec (patch)
tree542b1684d08b9c21f0bd7335513a46f29a61609f /archinstall/lib/disk
parent02af5fb6b2e134b78e45266b82c1689a96606c19 (diff)
Attempt to fetch partuuid multiple times (#1770)
* Attempt to fetch partuuid multiple times * Update --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/device_handler.py34
1 files changed, 27 insertions, 7 deletions
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):
"""