Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk.py12
-rw-r--r--archinstall/lib/installer.py30
2 files changed, 24 insertions, 18 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index e5aa9a85..1a2dc4dc 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -126,6 +126,18 @@ class BlockDevice():
def partition_table_type(self):
return GPT
+ @property
+ def uuid(self):
+ log(f'BlockDevice().uuid is untested!', level=LOG_LEVELS.Warning, fg='yellow')
+ """
+ Returns the disk UUID as returned by lsblk.
+ This is more reliable than relying on /dev/disk/by-partuuid as
+ it doesn't seam to be able to detect md raid partitions.
+ """
+ lsblk = b''.join(sys_command(f'lsblk -J -o+UUID {self.path}'))
+ for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']:
+ return partition.get('uuid', None)
+
def has_partitions(self):
return len(self.partitions)
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index af973227..0c622129 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -257,7 +257,12 @@ class Installer():
return True
def detect_encryption(self, partition):
- return partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS')
+ if partition.encrypted:
+ return partition
+ elif partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS':
+ return Partition(partition.parent, None, autodetect_filesystem=True)
+
+ return False
def minimal_installation(self):
## Add necessary packages if encrypting the drive
@@ -375,26 +380,15 @@ class Installer():
## so we'll use the old manual method until we get that sorted out.
- if self.detect_encryption(root_partition):
- log(f"Identifying root partition by DISK-UUID on {root_partition}, looking for '{os.path.basename(root_partition.real_device)}'.", level=LOG_LEVELS.Debug)
- for root, folders, uids in os.walk('/dev/disk/by-uuid'):
- for uid in uids:
- real_path = os.path.realpath(os.path.join(root, uid))
-
- log(f"Checking root partition match {os.path.basename(real_path)} against {os.path.basename(root_partition.real_device)}: {os.path.basename(real_path) == os.path.basename(root_partition.real_device)}", level=LOG_LEVELS.Debug)
- if not os.path.basename(real_path) == os.path.basename(root_partition.real_device): continue
-
- entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n')
-
- self.helper_flags['bootloader'] = bootloader
- return True
- break
+ if (real_device := self.detect_encryption(root_partition)):
+ log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=LOG_LEVELS.Debug)
+ entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n')
else:
- log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{os.path.basename(root_partition.path)}'.", level=LOG_LEVELS.Debug)
+ log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=LOG_LEVELS.Debug)
entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp\n')
- self.helper_flags['bootloader'] = bootloader
- return True
+ self.helper_flags['bootloader'] = bootloader
+ return True
raise RequirementError(f"Could not identify the UUID of {root_partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.")
else: