From 2c73989da4fc19de86e273f9fdda9840b312dff5 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 5 Apr 2021 11:38:17 +0200 Subject: Removed a TODO comment --- archinstall/lib/luks.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'archinstall/lib/luks.py') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 62067ec1..a1d42196 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -43,8 +43,6 @@ class luks2(): return True def encrypt(self, partition, password=None, key_size=512, hash_type='sha512', iter_time=10000, key_file=None): - # TODO: We should be able to integrate this into the main log some how. - # Perhaps post-mortem? if not self.partition.allow_formatting: raise DiskError(f'Could not encrypt volume {self.partition} due to it having a formatting lock.') -- cgit v1.2.3-70-g09d2 From ae2da06075763d388c303e8cd7914694454aa8fb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 19:56:29 +0200 Subject: Added a safety check to verify that the encrypted partition exists at least before trying to open it. --- archinstall/lib/luks.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'archinstall/lib/luks.py') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index a1d42196..b076ac9b 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -1,5 +1,7 @@ import os import shlex +import time +import pathlib from .exceptions import * from .general import * from .disk import Partition @@ -123,6 +125,11 @@ class luks2(): from .disk import get_filesystem_type if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead? + + wait_timer = time.time() + while pathlib.Paht(partition.path).exists() is False and time.time() - wait_timer < 10: + time.sleep(0.025) + sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2') if os.path.islink(f'/dev/mapper/{mountpoint}'): self.mapdev = f'/dev/mapper/{mountpoint}' -- cgit v1.2.3-70-g09d2 From 437315669f5fe38f90abb8d6f4da9ea60b9f6c12 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Fri, 9 Apr 2021 05:00:43 +0200 Subject: Fix typo that causes crash when creating encrypted LUKS partition (closes #248) --- archinstall/lib/luks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/luks.py') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index b076ac9b..561d4d6e 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -127,7 +127,7 @@ class luks2(): os.path.basename(mountpoint) # TODO: Raise exception instead? wait_timer = time.time() - while pathlib.Paht(partition.path).exists() is False and time.time() - wait_timer < 10: + while pathlib.Path(partition.path).exists() is False and time.time() - wait_timer < 10: time.sleep(0.025) sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2') -- cgit v1.2.3-70-g09d2 From b9148f6d3be590ec3301337ea2b895d90a9ff9ac Mon Sep 17 00:00:00 2001 From: NicoHood Date: Sat, 10 Apr 2021 10:55:49 +0200 Subject: fix typo --- archinstall/lib/luks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall/lib/luks.py') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 561d4d6e..ca077b3d 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -116,7 +116,7 @@ class luks2(): def unlock(self, partition, mountpoint, key_file): """ - Mounts a lukts2 compatible partition to a certain mountpoint. + Mounts a luks2 compatible partition to a certain mountpoint. Keyfile must be specified as there's no way to interact with the pw-prompt atm. :param mountpoint: The name without absolute path, for instance "luksdev" will point to /dev/mapper/luksdev -- cgit v1.2.3-70-g09d2