diff --git a/usr/local/bin/install_to_disk.sh b/usr/local/bin/install_to_disk.sh index c2f986f..f21e51c 100755 --- a/usr/local/bin/install_to_disk.sh +++ b/usr/local/bin/install_to_disk.sh @@ -286,12 +286,19 @@ install_grub() { fi # Install GRUB for UEFI (must succeed) + # Use --removable flag to install to default EFI fallback location log " Installing GRUB for UEFI boot..." - if ! sudo arch-chroot "$mount_point" grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=STORMUX-HDD --recheck 2>&1 | tee -a "$LOGFILE"; then + if ! sudo arch-chroot "$mount_point" grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=STORMUX-HDD --recheck --removable 2>&1 | tee -a "$LOGFILE"; then error_exit "UEFI GRUB installation failed" fi log " UEFI boot installation succeeded" + # Verify /etc/default/grub exists before generating config + if [[ ! -f "$mount_point/etc/default/grub" ]]; then + log_error "/etc/default/grub not found on target system" + error_exit "Cannot generate GRUB config without /etc/default/grub" + fi + # Generate GRUB configuration log " Generating GRUB configuration..." if ! sudo arch-chroot "$mount_point" grub-mkconfig -o /boot/grub/grub.cfg 2>&1 | tee -a "$LOGFILE"; then