From 9a9232aeed72e2d319418d06c790620db0db4ad2 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 24 Jan 2026 12:23:45 -0600 Subject: Fix LUKS btrfs installation and reduce ISO size - Fix GRUB cryptodisk: configure_grub() heredoc was overwriting LUKS settings added by configure_luks_grub(). Moved LUKS GRUB config (GRUB_ENABLE_CRYPTODISK=y, cryptdevice cmdline) into configure_grub() after the heredoc writes the base config. - Fix ISO bloat: archsetup copy was including vm-images (17GB). Changed from cp -r to rsync with exclusions for vm-images, test-results, .qcow2, and .iso files. ISO now 2.0GB. - btrfs-luks VM test now passes. --- custom/lib/btrfs.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'custom') diff --git a/custom/lib/btrfs.sh b/custom/lib/btrfs.sh index 47c6f42..90c5e6d 100644 --- a/custom/lib/btrfs.sh +++ b/custom/lib/btrfs.sh @@ -105,11 +105,14 @@ configure_luks_grub() { local uuid uuid=$(blkid -s UUID -o value "$partition") + # Enable GRUB cryptodisk support (required for encrypted /boot) + echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub + # Add cryptdevice to GRUB cmdline sed -i "s|^GRUB_CMDLINE_LINUX=\"|GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=$uuid:$LUKS_MAPPER_NAME:allow-discards |" \ /mnt/etc/default/grub - info "GRUB configured with cryptdevice parameter." + info "GRUB configured with cryptdevice parameter and cryptodisk enabled." } ############################# @@ -399,6 +402,25 @@ GRUB_DISABLE_OS_PROBER=true GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION=true EOF + # Add LUKS encryption settings if enabled + if [[ "$NO_ENCRYPT" != "yes" && -n "$LUKS_PASSPHRASE" ]]; then + echo "" >> /mnt/etc/default/grub + echo "# LUKS encryption support" >> /mnt/etc/default/grub + echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub + + # Get UUID of encrypted partition and add cryptdevice to cmdline + # Find the LUKS partition (partition 2 of the first disk) + local luks_part + luks_part=$(echo "$DISKS" | cut -d',' -f1)2 + if [[ -b "$luks_part" ]]; then + local uuid + uuid=$(blkid -s UUID -o value "$luks_part") + sed -i "s|^GRUB_CMDLINE_LINUX=\"|GRUB_CMDLINE_LINUX=\"cryptdevice=UUID=$uuid:$LUKS_MAPPER_NAME:allow-discards |" \ + /mnt/etc/default/grub + info "Added cryptdevice parameter for LUKS partition." + fi + fi + # Create /boot/grub directory mkdir -p /mnt/boot/grub -- cgit v1.2.3