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.
/boot
, efi partition,/dev
,/sys
, etc) on your recovery environment, thenchroot
to your Linux root and re-install grub usinggrub-install
.