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:
authorAnton Hvornum <anton@hvornum.se>2022-04-26 21:57:33 +0200
committerGitHub <noreply@github.com>2022-04-26 21:57:33 +0200
commita63e8ae7f99ac41673536cfcf8fcc5c4d724a2ee (patch)
tree03ed9d0156f1d0c407805c2c2e2873d8050207b6 /archinstall/lib/disk
parent59c35df0676977c93ed7276237179c9af8d9c476 (diff)
Torxed issue 1083 (#1090)
* Optimized a bunch of partprobe calls. Namely fixed sleep calls, added optional path to the general archinstall.partprobe() call. And fixed some error handling in a few places which should tell us where #1083 might be going wrong. * Fixed some flake8 complaints * Fixed sleep having a min() of 0.1 or given value. * Fixed sleep having a correct range variable. * Fixed sleep logic to use max() instead of min() as it will never use the higer sleep values otheride * Added error handling to Partition().partprobe() as it would cause certain issues with USB disks. Also made Partition()._safe_uuid more safe by eliminating exceptions being raised.
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/partition.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/archinstall/lib/disk/partition.py b/archinstall/lib/disk/partition.py
index a44efa26..e7568258 100644
--- a/archinstall/lib/disk/partition.py
+++ b/archinstall/lib/disk/partition.py
@@ -192,7 +192,9 @@ class Partition:
For bind mounts all the subvolumes share the same uuid
"""
for i in range(storage['DISK_RETRY_ATTEMPTS']):
- self.partprobe()
+ if not self.partprobe():
+ raise DiskError(f"Could not perform partprobe on {self.device_path}")
+
time.sleep(max(0.1, storage['DISK_TIMEOUTS'] * i))
partuuid = self._safe_uuid
@@ -208,13 +210,11 @@ class Partition:
This function should only be used where uuid is not crucial.
For instance when you want to get a __repr__ of the class.
"""
- try:
- self.partprobe()
- except SysCallError as partprobe_error:
+ if not self.partprobe():
if self.block_device.info.get('TYPE') == 'iso9660':
return None
- raise DiskError(f"Could not get PARTUUID of partition {self} due to partprobe error: {partprobe_error}")
+ log(f"Could not reliably refresh PARTUUID of partition {self.device_path} due to partprobe error.", level=logging.DEBUG)
try:
return SysCommand(f'blkid -s PARTUUID -o value {self.device_path}').decode('UTF-8').strip()
@@ -223,7 +223,7 @@ class Partition:
# Parent device is a Optical Disk (.iso dd'ed onto a device for instance)
return None
- raise DiskError(f"Could not get PARTUUID of partition {self}: {error}")
+ log(f"Could not get PARTUUID of partition using 'blkid -s PARTUUID -o value {self.device_path}': {error}")
@property
def encrypted(self) -> Union[bool, None]:
@@ -267,8 +267,12 @@ class Partition:
yield result
def partprobe(self) -> bool:
- if self.block_device and SysCommand(f'partprobe {self.block_device.device}').exit_code == 0:
- return True
+ try:
+ if self.block_device:
+ return 0 == SysCommand(f'partprobe {self.block_device.device}').exit_code
+ except SysCallError as error:
+ log(f"Unreliable results might be given for {self.path} due to partprobe error: {error}", level=logging.DEBUG)
+
return False
def detect_inner_filesystem(self, password :str) -> Optional[str]: