From d2d80113b3c6a337097b407674f67b84cc14c82a Mon Sep 17 00:00:00 2001 From: Hugo Ankarloo Date: Mon, 20 Sep 2021 19:30:07 +0200 Subject: Fix Bug: Timezone is ignored, always same as host Bug affects normal interactive usage (example/guided.py). The timezone configured in the installer is not the timezone that ends up in the new installed system. Instead, the timezone used in the host system (from where the installer is run) is the one that finally ends up being used. Reason: systemd-nspawn by default copies the host timezone into the target. And systemd-nspawn is run when keyboard-layout is changed (which is done after changing the timezone). Solution: Add option `--timezone=off` to systemd-nspawn, which hinders affecting the timezone in the target. --- archinstall/lib/systemd.py | 1 + 1 file changed, 1 insertion(+) (limited to 'archinstall') diff --git a/archinstall/lib/systemd.py b/archinstall/lib/systemd.py index 383f1f17..d297c507 100644 --- a/archinstall/lib/systemd.py +++ b/archinstall/lib/systemd.py @@ -64,6 +64,7 @@ class Boot: self.session = SysCommandWorker([ '/usr/bin/systemd-nspawn', '-D', self.instance.target, + '--timezone=off', '-b', '--machine', self.container_name ]) -- cgit v1.2.3-70-g09d2 From ffbfafb35428168366de3ced572f648c6d49dc03 Mon Sep 17 00:00:00 2001 From: Hugo Ankarloo Date: Mon, 20 Sep 2021 19:58:56 +0200 Subject: Fix Bug: config b0rked by Suggest partition layout File: lib/user_interaction.py When function manage_new_and_existing_partitions() is used, and 'Suggest partition layout' is selected, the partition info is not correctly stored in the config. Instead of: {"partitions": [{...}, {...}]} You get: {"partitions": {"partitions": [{...}, {...}], "wipe":True}} --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b017e41a..66dd3350 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -674,7 +674,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: if input(f"{block_device} contains queued partitions, this will remove those, are you sure? y/N: ").strip().lower() in ('', 'n'): continue - block_device_struct["partitions"] = suggest_single_disk_layout(block_device)[block_device] + block_device_struct.update( suggest_single_disk_layout(block_device)[block_device] ) elif task is None: return block_device_struct else: -- cgit v1.2.3-70-g09d2 From 915ae88947a008a21006d2572e498ed0c134350c Mon Sep 17 00:00:00 2001 From: Hugo Ankarloo Date: Mon, 20 Sep 2021 20:17:39 +0200 Subject: Fix Bug: Set filesystem crashes if no partitions File: lib/user_interaction.py When function manage_new_and_existing_partitions() is used, and no partitions are configured, and 'Set desired filesystem for a partition' is selected, the installer crashes. --- archinstall/lib/user_interaction.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 66dd3350..ca8fb6f6 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -730,7 +730,10 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['boot'] = not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('boot', False) elif task == "Set desired filesystem for a partition": - if (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)): + if not block_device_struct["partitions"]: + log("No partitions found. Create some partitions first", level=logging.WARNING, fg='yellow') + continue + elif (partition := generic_select(block_device_struct["partitions"], 'Select which partition to set a filesystem on: ', options_output=False)): if not block_device_struct["partitions"][block_device_struct["partitions"].index(partition)].get('filesystem', None): block_device_struct["partitions"][block_device_struct["partitions"].index(partition)]['filesystem'] = {} -- cgit v1.2.3-70-g09d2 From 26244212cfe2d2ecbf7c791c811deb499e7a3bcf Mon Sep 17 00:00:00 2001 From: Hugo Ankarloo Date: Mon, 20 Sep 2021 21:46:56 +0200 Subject: Fix Bug: Cannot get partuuid from loop device File: lib/disk.py When installing on a loopback device (a.k.a loop device), function Filesystem.partuuid_to_index() crashes with a JSON parsing error. REASON 1) For loop devices, the property BlockDevice.device returns the actual image file (back-file) of the loop device instead of the /dev/X device. 2) Function Filesystem.partuuid_to_index() executes `lsblk --json` against BlockDevice.device . 3) `lsblk` fails and prints the error "not a block device" to stderr. This causes the output to not be valid JSON. 4) Code crashes when JSON parser tries to parse the output. SOLUTION - Make sure property BlockDevice.device only returns a valid block device. - Create new function BlockDevice.device_or_backfile that mimics the present behaviour of BlockDevice.device. - Use BlockDevice.device_or_backfile in function BlockDevice.__repr__(). SOLUTION REASONING I can only see one reason behind BlockDevice.device returning the back-file of a loop device, and that is to show the back-file to the user (instead of /dev/X) when printing the string representation of a BlockDevice. All other parts of the code can use the /dev/X file just fine. And IMO it makes more sense that a property named `device` only returns devices, and not normal files. --- archinstall/lib/disk.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index c86bf7bc..33f598bf 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -244,7 +244,7 @@ class BlockDevice: # I'm placing the encryption password on a BlockDevice level. def __repr__(self, *args, **kwargs): - return f"BlockDevice({self.device}, size={self.size}GB, free_space={'+'.join(part[2] for part in self.free_space)}, bus_type={self.bus_type})" + return f"BlockDevice({self.device_or_backfile}, size={self.size}GB, free_space={'+'.join(part[2] for part in self.free_space)}, bus_type={self.bus_type})" def __iter__(self): for partition in self.partitions: @@ -285,23 +285,33 @@ class BlockDevice: return device['pttype'] @property - def device(self): + def device_or_backfile(self): """ Returns the actual device-endpoint of the BlockDevice. If it's a loop-back-device it returns the back-file, - If it's a ATA-drive it returns the /dev/X device - And if it's a crypto-device it returns the parent device + For other types it return self.device """ - if "type" not in self.info: - raise DiskError(f'Could not locate backplane info for "{self.path}"') - if self.info['type'] == 'loop': for drive in json.loads(SysCommand(['losetup', '--json']).decode('UTF_8'))['loopdevices']: if not drive['name'] == self.path: continue return drive['back-file'] - elif self.info['type'] == 'disk': + else: + return self.device + + @property + def device(self): + """ + Returns the device file of the BlockDevice. + If it's a loop-back-device it returns the /dev/X device, + If it's a ATA-drive it returns the /dev/X device + And if it's a crypto-device it returns the parent device + """ + if "type" not in self.info: + raise DiskError(f'Could not locate backplane info for "{self.path}"') + + if self.info['type'] in ['disk','loop']: return self.path elif self.info['type'][:4] == 'raid': # This should catch /dev/md## raid devices -- cgit v1.2.3-70-g09d2 From 5bcbb50936690deff12a085634215c2d4f42f38c Mon Sep 17 00:00:00 2001 From: Hugo Ankarloo Date: Tue, 21 Sep 2021 00:38:20 +0200 Subject: Fix Bug: 'Suggest partition layout' crashes File: lib/user_interaction.py When function manage_new_and_existing_partitions() is used, and 'Suggest partition layout' is selected, the installer crashes. REASON Bug was introduced in commit 9e67ce3, when partition layout was changed to use device.path as keys (instead of device). It seems all necessary changes were made for this, except this one. --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index be74f9b9..ba6259b1 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -674,7 +674,7 @@ def manage_new_and_existing_partitions(block_device :BlockDevice) -> dict: if input(f"{block_device} contains queued partitions, this will remove those, are you sure? y/N: ").strip().lower() in ('', 'n'): continue - block_device_struct.update( suggest_single_disk_layout(block_device)[block_device] ) + block_device_struct.update( suggest_single_disk_layout(block_device)[block_device.path] ) elif task is None: return block_device_struct else: -- cgit v1.2.3-70-g09d2