From 0ec7de39376ad39a361ec51dbb0e7b70272e82a5 Mon Sep 17 00:00:00 2001 From: N0VA Date: Mon, 9 Feb 2026 16:53:30 +0100 Subject: [PATCH] Fix UEFI GRUB installation: ensure ESP is mounted to /boot/efi and improve error logging --- iridium_installer/backend/os_install.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index 25d8f4f..8073d77 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -66,6 +66,8 @@ def run_command(cmd, check=True): stderr_str = "".join(stderr_lines) if check and returncode != 0: + error_msg = f"Command '{' '.join(cmd)}' failed with exit code {returncode}\nStderr: {stderr_str}" + log_to_discord("ERROR", error_msg, module="os_install") raise subprocess.CalledProcessError( returncode, cmd, output=stdout_str, stderr=stderr_str ) @@ -95,7 +97,8 @@ def mount_pseudo_fs(mount_root): target = os.path.join(mount_root, "sys/firmware/efi/efivars") os.makedirs(target, exist_ok=True) try: - run_command(["mount", "-t", "efivarfs", "efivarfs", target]) + # Use --bind if already mounted, or mount -t efivarfs + run_command(["mount", "--bind", efivars_path, target]) mounted_paths.append(target) except Exception as e: logger.warning(f"Failed to mount efivarfs: {e}") @@ -241,6 +244,15 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non with open(os.path.join(mount_root, "etc/fstab"), "w") as f: f.write("\n".join(fstab_lines) + "\n") + # Ensure EFI is mounted for GRUB installation + if uefi and partition_info.get("efi"): + efi_target = os.path.join(mount_root, "boot/efi") + os.makedirs(efi_target, exist_ok=True) + # Check if already mounted + res = subprocess.run(["mount"], capture_output=True, text=True) + if efi_target not in res.stdout: + run_command(["mount", partition_info["efi"], efi_target]) + with mount_pseudo_fs(mount_root): # 2. Configure User if user_info: @@ -295,4 +307,4 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non run_command(["sync"]) logger.info("System configuration complete.") - log_os_install("CONFIGURE", "complete", "systemd-boot and user configured successfully") + log_os_install("CONFIGURE", "complete", "GRUB2 and user configured successfully")