Description: Fix encrypted installs in Calamares Adding new items to /etc/default/grub wasn't working (new items that were to be added to the file were being silently dropped). This resulted in the GRUB_ENABLE_CRYPTODISK setting not being present in /etc/default/grub within the installed system, resulting in the bootloader refusing to install in an encrypted installation. This patch adds the needed functionality to the grubcfg module to fix the issue. Author: Aaron Rainbolt Origin: ubuntu Bug: https://github.com/calamares/calamares/issues/2233 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/calamares/+bug/2043301 Forwarded: https://github.com/calamares/calamares/pull/2234 Last-Update: 2023-11-14 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 82b1837f8..d2ed8bf19 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -104,11 +104,17 @@ def update_existing_config(default_grub, grub_config_items): # check if this is one of the keys we care about if key in grub_config_items.keys(): print(f"{key}={grub_config_items[key]}") + del grub_config_items[key] else: print(line) else: print(line) + if len(grub_config_items) != 0: + with open(default_grub, "a") as grub_file: + for dict_key, dict_val in grub_config_items.items(): + grub_file.write(f"{dict_key}={dict_val}") + def modify_grub_default(partitions, root_mount_point, distributor): """