Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I had a single Linux hard drive with LUKS partitions. Linux was installed in legacy mode, but it worked with UEFI option turned on later.

I decided to install a Windows 8 on a second hard drive. So I unplugged the Linux drive, plugged the other one, installed the Windows with UEFI on by default, booted, updated. Windows 8 was installed in UEFI mode w/o secure boot.

Replugged back the Linux drive, and now I cannot get them both to work through GRUB without going into BIOS every time flipping UEFI. Both drives are in a PC. I can only boot Windows if UEFI is on or Linux if UEFI is off.

Is there a way to fix the GRUB? UEFI menu entries?

share|improve this question
    
Why do you use grub? If you have UEFI you don't need it. Here's an answer which covers how to set up UEFI and Linux: Windows 7 and Debian on UEFI. You didn't specify the distribution or kernel you use. If your kernel is already compiled with efi stub support, you can skip most of the stuff mentioned in the answer and simply add Linux to your UEFI boot list. –  Marco Mar 16 '13 at 10:16
    
I think you can't turn off UEFI, instead you turn on CSM (Compatibility Support Module) which will emulate a legacy PC BIOS. Do you only change CSM or do need to make more changes in firmware to allow Linux boot? Which boot devices are listed in which order in firmware in both boot configurations? –  Pro Backup Aug 12 at 9:39

2 Answers 2

If you installed Linux in legacy mode, you will only ever be able to boot it in legacy mode. Reinstall Linux in UEFI mode.

share|improve this answer
    
Some Linux legacy mode installations can be converted into UEFI mode without a reinstall, see Which commands to convert a Ubuntu BIOS install to EFI/UEFI without boot-repair on single boot hardware? –  Pro Backup Aug 12 at 10:25

The reason that your Linux installation is not seen after swapping drives might be dependent on the logic of your UEFI firmware. GRUB keeps your different boot options in a configuration file. UEFI does this in its NVRAM. The UEFI entry in its NVRAM does most of the times contain a pointer to a hardware device and the location of the efi file. Two examples:

Boot0000* Linux   HD(1,64800,670f800,000009b6) File(\elilo.efi)
Boot0003* ubuntu  HD(3,800,64000,000009b6)     File(\EFI\ubuntu\grubx64.efi)

Some firmware logic might have removed your UEFI NVRAM entry during POST as soon as the hardware or the path was no longer available. This happens all the times when setting a USB device as boot device and later on removing that USB device. After re-attaching a USB drive it will no longer boot from it. Windows though might still boot because it has the tendency to copy a backup of their efi bootloader at the default location: EFI/BOOT/bootx64.efi on x86-64 systems.

To fix UEFI menu entries you can boot info UEFI prompt and use bcfg or use a Linux Live CD and use efibootmgr. You could also do a similar approach as Windows, copy and rename your linux efi file to the default location on the EFI partition.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.