From 77e1407c5110b32259230c33f46912c87a834579 Mon Sep 17 00:00:00 2001 From: Masato Toyoshima Date: Tue, 14 Feb 2023 04:30:24 +0900 Subject: [PATCH 1/5] During installation, if a swap partition exists, enable swap. If there is no swap at all when the partition of the installation destination device is mounted, if a Swap partition exists, enable swap. --- src/modules/mount/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index cb36120d8..ddf46d8e9 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -307,7 +307,7 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun mount_option) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) -def enable_swap_partition(swap_partitions): +def enable_swap_partitions(swap_partitions): try: for swap_device in swap_partitions: libcalamares.utils.host_env_process_output(["swapon", swap_device]) @@ -328,9 +328,8 @@ def run(): _("No partitions are defined for
{!s}
to use.").format("mount")) # swap - swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' and p['claimed'] == False ] - if ( swap_partitions != [] ): - enable_swap_partition(swap_partitions) + swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' ] + enable_swap_partitions(swap_partitions) root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") From 6c25be670da9e96ac7d662d8fb38d391e3448df9 Mon Sep 17 00:00:00 2001 From: Masato Toyoshima Date: Tue, 21 Feb 2023 22:24:11 +0900 Subject: [PATCH 2/5] Added automatic enabling of swap partition before installation starts. Mainly to suppress installer stoppages caused by oom killer. --- src/modules/mount/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index ddf46d8e9..9d5d89bef 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -329,7 +329,8 @@ def run(): # swap swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' ] - enable_swap_partitions(swap_partitions) + if ( swap_partitions != [] ): + enable_swap_partition(swap_partitions) root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") From 00387511060949b8d32bae6e0c978ccf222d8577 Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA <77603626+phoepsilonix@users.noreply.github.com> Date: Sun, 26 Feb 2023 02:04:37 +0900 Subject: [PATCH 3/5] UAdded automatic enabling of swap partition before installation starts. Mainly to suppress installer stoppages caused by oom killer. --- src/modules/mount/main.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 9d5d89bef..f38935578 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -307,12 +307,23 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun mount_option) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) +<<<<<<< ours def enable_swap_partitions(swap_partitions): try: for swap_device in swap_partitions: libcalamares.utils.host_env_process_output(["swapon", swap_device]) except subprocess.CalledProcessError: libcalamares.utils.warning("Failed to swapon " + swap_device) +||||||| base +======= +def enable_swap_partition(swap_device): + try: + for d in swap_device: + subprocess.check_call(["swapon", d]) + except subprocess.CalledProcessError: + raise Exception(_("Failed to swapon " + swap_device)) + +>>>>>>> theirs def run(): """ @@ -327,11 +338,19 @@ def run(): return (_("Configuration Error"), _("No partitions are defined for
{!s}
to use.").format("mount")) +<<<<<<< ours # swap - swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' ] + swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p.get("claimed", None) )] if ( swap_partitions != [] ): enable_swap_partition(swap_partitions) +||||||| base +======= + swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p['claimed'] == True ) ] + if swap_partitions != [] : + enable_swap_partition(swap_partitions) + +>>>>>>> theirs root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") # Get the mountOptions, if this is None, that is OK and will be handled later From 5513ffcd1cefd8be12cfe1a3ed2a71b2a7428870 Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA <77603626+phoepsilonix@users.noreply.github.com> Date: Sun, 26 Feb 2023 07:24:12 +0900 Subject: [PATCH 4/5] Update main.py --- src/modules/mount/main.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index f38935578..40ab731ed 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -307,15 +307,6 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun mount_option) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) -<<<<<<< ours -def enable_swap_partitions(swap_partitions): - try: - for swap_device in swap_partitions: - libcalamares.utils.host_env_process_output(["swapon", swap_device]) - except subprocess.CalledProcessError: - libcalamares.utils.warning("Failed to swapon " + swap_device) -||||||| base -======= def enable_swap_partition(swap_device): try: for d in swap_device: @@ -323,8 +314,6 @@ def enable_swap_partition(swap_device): except subprocess.CalledProcessError: raise Exception(_("Failed to swapon " + swap_device)) ->>>>>>> theirs - def run(): """ Mount all the partitions from GlobalStorage and from the job configuration. @@ -338,19 +327,10 @@ def run(): return (_("Configuration Error"), _("No partitions are defined for
{!s}
to use.").format("mount")) -<<<<<<< ours - # swap - swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p.get("claimed", None) )] - if ( swap_partitions != [] ): - enable_swap_partition(swap_partitions) - -||||||| base -======= swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p['claimed'] == True ) ] if swap_partitions != [] : enable_swap_partition(swap_partitions) ->>>>>>> theirs root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") # Get the mountOptions, if this is None, that is OK and will be handled later From c296f67356678c8182f5cd6c43364b372c9fc86c Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA <77603626+phoepsilonix@users.noreply.github.com> Date: Sun, 26 Feb 2023 07:48:51 +0900 Subject: [PATCH 5/5] Update main.py --- src/modules/mount/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 40ab731ed..2847f4909 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -310,7 +310,7 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun def enable_swap_partition(swap_device): try: for d in swap_device: - subprocess.check_call(["swapon", d]) + libcalamares.utils.host_env_process_output(["swapon", d]) except subprocess.CalledProcessError: raise Exception(_("Failed to swapon " + swap_device)) @@ -327,7 +327,7 @@ def run(): return (_("Configuration Error"), _("No partitions are defined for
{!s}
to use.").format("mount")) - swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p['claimed'] == True ) ] + swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p['claimed'] ) ] if swap_partitions != [] : enable_swap_partition(swap_partitions)