0

I installed Elementary OS, and everything worked nicely. I got GRUB when booting the computer, I could boot Windows and Elementary OS. The only problem was that Windows Boot Manager showed up twice in the EFI boot menu. One of them was GRUB, and the other was just Windows. I probably should have just left it alone, but I went into Windows and typed in bcdedit /set {bootmgr} description GRUB This ruined everything. This actually got rid of the Windows Boot Manager entry in EFI (the one that was secretly GRUB) and left the one that was just Windows. Now I can't get into Linux again. Most of the tutorials online are about getting GRUB back after installing Windows, or aren't for EFI. For this reason, I'm reluctant to follow those tutorials. They say to reinstall grub to MBR, even though I originally installed it to the EFI partition. That doesn't seem right to me.

EDIT: I got more information on the problem. I reinstalled GRUB, using a common method I found online. I then used efibootmgr, and it appears that when I renamed Windows Boot Manager to GRUB, the new entry was actually created. There is also an entry named ubuntu. However, neither of these entries is in the boot order. I can't change the boot order to add them in though. The command works, but the change does not get saved.

2
  • You likely need to re-install grub; you can use LiveCD as recovery environment. Mount your root partition and relevant other filesystems (separate /boot, efi partition, /dev, /sys, etc) on your recovery environment, then chroot to your Linux root and re-install grub using grub-install.
    – sebasth
    Commented Aug 10, 2017 at 16:05
  • That didn't work. Commented Aug 10, 2017 at 18:18

2 Answers 2

4

I see you found a solution; however, I'd like to point out at least part of the reason for the problem, since that may help you (or others) avoid similar problems in the future....

In the initial dual-boot configuration you describe (Windows/ElementaryOS), you have two boot managers:

  • The motherboard's (EFI's) built-in boot manager -- This boot manager relies on entries stored in NVRAM, which point to EFI boot programs. The NVRAM entries can be added, deleted, and otherwise modified via programs like efibootmgr in Linux, bcdedit in Windows, and EasyUEFI in Windows. Typically, a computer boots to its default EFI boot program automatically and without pausing to show you a menu at boot time; to get a menu, you must hit a system-specific key soon after you power on the computer or reboot it. Common options for this key include Esc, Enter, and a function key (typically F8 or above).
  • GRUB -- After you install ElementaryOS, GRUB should become the default boot program specified by the EFI's built-in boot manager. GRUB is itself a boot manager, though, and in a dual-boot configuration, it should show a boot menu when it runs. This boot menu is constructed through an on-disk configuration file, which is stored at /boot/grub/grub.cfg in ElementaryOS. (Another file, /boot/efi/EFI/ubuntu/grub.cfg, may also be involved.)

(Note: A boot manager presents a menu or some other way for a user to select which OS to boot. A boot manager typically hands off to a boot loader, which loads an OS kernel into memory and hands over control to the kernel. Some programs, including GRUB, are both boot managers and boot loaders; but others, like the EFI boot manager or the Linux EFI stub loader, are one or the other but not both. Linux users are often sloppy about distinguishing between these two types of programs because GRUB does both jobs.)

In any event, when you ran bcdedit in Windows, you adjusted the EFI's boot manager, but this had no effect on the GRUB configuration. Thus, you ended up bypassing GRUB, which of course is not what you'd intended. To modify GRUB's menu, you need to edit its configuration file, but that's a more awkward process than you might expect, since grub.cfg is actually constructed by scripts so that it can be customized for your particular system. The GRUB Customizer tool presents a relatively friendly GUI front-end to GRUB customization, but I'm not an expert on its use. It's also possible to use other boot managers and boot loaders in Linux, bypassing GRUB entirely.

Another issue that's likely relevant is Secure Boot. ElementaryOS is based on Ubuntu, which uses a program called Shim for Secure Boot Support. The Shim binary (shimx64.efi) is signed by Microsoft and is therefore trusted by most EFIs. Shim's main purpose is to expand the number of Secure Boot keys that the firmware will accept and to launch GRUB (grubx64.efi), which in turn is signed with another key (Canonical's, in the case of Ubuntu, and presumably also therefore ElementaryOS, although I've not checked this).

Given the nature of your solution, I suspect you had at least two entries for ElementaryOS in your EFI's NVRAM boot listing, one of which pointed to Shim and the other of which pointed to GRUB. I'm guessing that the one that pointed directly to GRUB came earlier in your boot order, but was ignored by the firmware because it failed the firmware's unmodified Secure Boot test. When you told the firmware to trust GRUB, though, it began passing the test and so GRUB would launch. It might have been set up some other way initially, but your mistake with bcdedit in Windows wiped out or changed the order of the entry that booted via Shim. Your re-installation of GRUB also likely mucked with things a bit.

If you want to understand this even better, I recommend you read one or more of the following:

Even the sum total of these pages won't tell you precisely what happened on your system, but you may be able to better diagnose it by examining your sudo efibootmgr -v output, and to fix similar problems should they occur in the future.

1
  • Wow, that's a lot of information. Thanks. I did efibootmgr -v, and you're right, there are 3 entries for Elementary OS, two with shim, and one with grub. I also found the Windows entry that I named GRUB. Commented Aug 11, 2017 at 1:22
1

I found the solution on my own. Apparently, I had to mark grubx64.efi as trusted in the UEFI settings. This is really strange though since I had Secure Boot off the whole time. Anyway, this added a new entry for the EFI bootloader, and this entry does indeed load GRUB, as it should.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .