From f4e5e08aa8f1f464c926dadba94096b34b5aab61 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 24 May 2022 15:18:50 +0200 Subject: [PATCH] [fstab] Be more careful in setting up btrfs swap - do not use subprocess module in Python bits, - do +C (no-CoW) after turning compression off --- src/modules/fstab/main.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index 95f10a643..2b261fc66 100755 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -173,7 +173,6 @@ class FstabGenerator(object): for p in self.partitions]): password = "none" crypttab_options = "" - return dict( name=mapper_name, @@ -342,10 +341,8 @@ def create_swapfile(root_mount_point, root_btrfs): swapfile_path = os.path.join(root_mount_point, "swap/swapfile") with open(swapfile_path, "wb") as f: pass - o = subprocess.check_output(["chattr", "+C", swapfile_path]) - libcalamares.utils.debug("swapfile attributes: {!s}".format(o)) - o = subprocess.check_output(["btrfs", "property", "set", swapfile_path, "compression", "none"]) - libcalamares.utils.debug("swapfile compression: {!s}".format(o)) + libcalamares.utils.host_env_process_output(["btrfs", "property", "set", swapfile_path, "compression", "none"]) + libcalamares.utils.host_env_process_output(["chattr", "+C", swapfile_path]) # No Copy-on-Write else: swapfile_path = os.path.join(root_mount_point, "swapfile") with open(swapfile_path, "wb") as f: @@ -363,8 +360,7 @@ def create_swapfile(root_mount_point, root_btrfs): libcalamares.job.setprogress(0.2 + 0.3 * ( total / desired_size ) ) total += chunk os.chmod(swapfile_path, 0o600) - o = subprocess.check_output(["mkswap", swapfile_path]) - libcalamares.utils.debug("swapfile mkswap: {!s}".format(o)) + libcalamares.utils.host_env_process_output(["mkswap", swapfile_path]) libcalamares.job.setprogress(0.5)