From acb5c26de04da19133fc36c84dcc62a096650214 Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Tue, 14 Nov 2023 17:35:30 -0600 Subject: [PATCH] Fix encrypted installations --- debian/changelog | 6 ++++ debian/patches/fix-encrypted-installs.patch | 37 +++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 44 insertions(+) create mode 100644 debian/patches/fix-encrypted-installs.patch diff --git a/debian/changelog b/debian/changelog index 362b6e1..f6baefa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +calamares (3.3.0-alpha4-0ubuntu2) noble; urgency=medium + + * Fixed encrypted installations. (LP: #2043301) + + -- Aaron Rainbolt Tue, 14 Nov 2023 17:32:18 -0600 + calamares (3.3.0-alpha4-0ubuntu1) noble; urgency=medium * New upstream release. diff --git a/debian/patches/fix-encrypted-installs.patch b/debian/patches/fix-encrypted-installs.patch new file mode 100644 index 0000000..9060e43 --- /dev/null +++ b/debian/patches/fix-encrypted-installs.patch @@ -0,0 +1,37 @@ +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): + """ diff --git a/debian/patches/series b/debian/patches/series index 683ca99..264ce89 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ 0001-replace-pkexec-by-sudo.patch apport-package-hook.patch +fix-encrypted-installs.patch