From 47c167dc046b04b4e7ae383d0f48848b8979fd86 Mon Sep 17 00:00:00 2001 From: Gabriel Craciunescu Date: Wed, 18 Mar 2020 17:21:20 +0100 Subject: [PATCH] [bootloader] Resume from outer swap partition - These fixes are similar to the other swap-from-LUKS changes, and just needed to be applied to a different module. --- src/modules/bootloader/main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 9d705adfc..31d22ff04 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -117,6 +117,7 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker partitions = libcalamares.globalstorage.value("partitions") swap_uuid = "" + swap_outer_mappername = None cryptdevice_params = [] @@ -124,18 +125,21 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker # - unencrypted swap partition sets swap_uuid # - encrypted root sets cryptdevice_params for partition in partitions: + if partition["fs"] == "linuxswap" and not partition.get("claimed", None): + continue has_luks = "luksMapperName" in partition if partition["fs"] == "linuxswap" and not has_luks: swap_uuid = partition["uuid"] + if (partition["fs"] == "linuxswap" and has_luks): + swap_outer_mappername = partition["luksMapperName"] + if partition["mountPoint"] == "/" and has_luks: cryptdevice_params = ["cryptdevice=UUID=" + partition["luksUuid"] + ":" + partition["luksMapperName"], "root=/dev/mapper/" - + partition["luksMapperName"], - "resume=/dev/mapper/" + partition["luksMapperName"]] if cryptdevice_params: @@ -146,6 +150,10 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker if swap_uuid: kernel_params.append("resume=UUID={!s}".format(swap_uuid)) + if swap_outer_mappername: + kernel_params.append("resume=/dev/mapper/{!s}".format( + swap_outer_mappername)) + kernel_line = get_kernel_line(kernel_type) libcalamares.utils.debug("Configure: \"{!s}\"".format(kernel_line))