An answer posted here should:
- Avoid to require the user to download and install additional packages or PPAs.
- Be as quick and simple as possbile. (I tried boot-repair and it didn't qualify.)
- Probably provide a script for users who don't have much experience with the terminal.
Similar issues like these have been posted several times to the site:
- A recent release of Ubuntu has been successfully installed on a UEFI-capable machine that came with a preinstalled copy of Windows 8 or later.
- The output of
efibootmgr -v
shows that/efi/ubuntu/shimx64.efi
has been registered asubuntu
. (These new boot entries are usually added with the highest priority. See also Change boot order using efibootmgr) - After rebooting, no OS selection menu (GRUB) was shown and the machine booted directly to Windows.
- The output of
- When accessing the firmware settings menu (formerly called BIOS):
- There is no indication of how to change the boot order for indivual operating systems or there are no operating systems (like
Windows Boot Manager
) displayed at all, only devices. - The Secure Boot feature is turned off in firmware settings.
- There is no indication of how to change the boot order for indivual operating systems or there are no operating systems (like
- Ubuntu was installed by booting the live media in UEFI mode, not by running the WUBI-Installer in Windows.
- The Windows installation itself was not modified, replaced or erased.
- The drive contains a GPT partition table.
- Windows Diskmanagement shows that at least the following 3 partitions exist on the disk:
- EFI System Partition
- Windows partition
- an unreadable RAW partition that could be the Ubuntu installation
- You tried removing the
\EFI\BOOT\
directory entirely, before(!) backing it up.
This usually indicates an issue with the default bootloader or bootprocess being somewhat hardcoded to boot Windows. In most cases this can easily be fixed by replacing \EFI\BOOT\BOOTx64.EFI
with another file that also allows for booting other operating systems.
The short answer
You can create a
bootx64.efi
binary from within the Ubuntu live media with grub-mkimage and write a customgrub.cfg
to chainload the loaders you wan't to boot and copy both files to the EFI System Partition (ESP) into the directory\EFI\BOOT\
.If you don't know your way around in the terminal, the script available in the following section of this answer will do this for you. For more details have a look at the Technical details section in The longer answer.
Scripted for your convenience
Regarding this script:
grub-efi-amd64
package where it runs and therefore will break legacy MBR installs. Probably only run it from live media if possible./isodevice
. GUI: Computer ➜ isodevice in Nautilus/File Manager.The longer answer
The problem
The UEFI specification recommends firmware implementers to boot via a default bootloader named
\EFI\BOOT\BOOT{arch}.EFI
for booting from external media, e.g. where relying on NVRAM entries in the platform – the computers' mainboard – to boot a particular operating system is not possible. Currently defined values forarch
arex64
for AMD64,ia32
for i386 andARM
orA64
for ARM.Windows and Fedora install such a bootloader on the ESP, while Ubuntu currently does not. The firmware in some computers – like budget-priced laptops – shows a behaviour where these devices seem to completly ignore correctly registered UEFI bootloaders in the NVRAM bootcatalog and default to booting from
\EFI\BOOT\BOOT{arch}.EFI
, which will usually result in booting Windows instead of Ubuntu.Technical details
This configuration currently doesn't support Secure Boot and also hasn't been tested for Apple computers, as I don't own such a machine. (Help is much appreciated.)
If it hasn't been clear until now: This will also allow booting the OS installations on the disk in another UEFI-capable computer, similar to how it has been with legacy MBR.
Generating the
bootx64.efi
image with GRUBCreating a corresponding
grub.cfg
fileThis configuration covers the basic cases of booting Ubuntu, booting Windows and launching the firmware setup. The last entry allows for loop mounting and booting an ISO image, which might look odd at first because the ESP usually is only a few hundred megabytes large and can't store such big files, but both files also work on FAT formatted USB drives. A multiboot USB drive with several ISOs is just a few edits away. Also you could easily replace
ubuntu
withfedora
to create another menu entry that boots Fedora or any other Linux distribution, just have a look at the contents of your ESP.Appendix
What about gummiboot and PreLoader?
I have posted something like that in the past and there is nothing wrong with that as far as I can see. It even works with Secure Boot. Good if it worked for you, but the user experience including downloading, creating and extracting several files manually isn't quite optimal and rather difficult for the average user.
Example output
Example output of running the script from live media:
An output of efibootmgr would have help determined if the order was correct.
So from my understanding, it is a matter of changing the boot order so that the entry for grub is the default. I had that issue too.
As you can't boot into ubuntu to solve this or do that in the UEFI/BIOS, you can boot a LiveCD of Ubuntu, and drop into a terminal or a console
You open a teminal and run
and you change the order of the boot entries
and run again efibootmgr to check the change is effective. it should change the bootnext value too else you can run