How do I get my HP laptop to boot into grub from my new efi file?

Solution 1:

I had this same problem with my HP Pavilion g6 when trying to dual boot Ubuntu 12.04.3 LTS and Windows 8. That is, even after "successfully" running Boot-Repair, I still had the notebook booting directly into Windows 8. If I pressed F9 before the HP symbol showed up, I was able to get into a Boot Menu (HP's menu? I don't know...) and from there, to select the "Ubuntu" entry, which in turn took me to GRUB 2 and finally to my Ubuntu installation.

Still, I wanted to be able to have the computer boot directly to Linux, without the need for any user intervention.

In the end, Rod Smith's answer above, combined with the information that I found in another forum, did the trick for me. I have Secure Boot disabled and Legacy Boot also disabled.

This is what I did:

  • I booted into my Ubuntu installation using the trick of the F9 key in the start up to be able to choose the boot loader.
  • Once in Ubuntu, I opened a terminal.
  • Using the command below, I checked where Windows boot loader was located:

    $ sudo efibootmgr -v
    
  • In my case, the original boot loader was in here: /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi . Please note that in your computer it might be in a different place. If so, you will need to adjust the commands below.

  • As per Rod's recommendation in his answer (the one about how to repair the boot loader manually), I made a backup of that file by moving it one level up:

    $ sudo cp /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/bootmgfw.efi
    
  • Finally, I copied GRUB2's boot loader in that place, "tricking" the system into loading the boot loader I wanted instead of Windows' original boot loader.

    $ sudo cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
    

So finally I had my dual boot working with GRUB2. In case Windows overwrites the boot loader again after an update (as it did with me), I already know the steps to get grub back to its place.

Hope this helps someone. Please let me know if there are any issues with my solution.

Solution 2:

I faced the same problem on HP ProBook 4340s with original Windows 8 already overwritten by new Kubuntu 15.04 (I prefer no dual boot). Among other tries, I also tried Boot-Repair (both from HD after its installation and via boot-repair-disk), but that exercise was most probably unnecessary.

What made the trick was the following changes in the BIOS Setup (after computer start push F10 - go to System Configuration - open Boot Options):

  1. Check Customized Boot

  2. Check off SecureBoot

  3. Boot Mode: choose UEFI Hybrid or UEFI Native (I chose UEFI Native)

  4. UEFI Boot Order: put Customized Boot to the top

  5. Define Customized Boot Option: choose Add + put the setting: \EFI\ubuntu\grubx64.efi

We found the correct path string when opening the GRUB via the Boot from EFI File option in the Fast Boot Options (F9). In the beginning, the options list contained:

  • OS boot Manager
  • Boot from EFI File

After adding the Customized Boot option, it was added to the list:

  • Customized Boot
  • OS boot Manager
  • Boot from EFI File

Solution 3:

Ordinarily, running Boot Repair backs up Microsoft's original boot loader file (bootmgfw.efi) as bootmgfw.efi.bkp and replaces the original bootmgfw.efi file with a copy of GRUB (or shim), and the Boot Repair output you posted would show this; however, I don't see such a backup file. Thus, I recommend you do one of three things:

  • Run Boot Repair again, but look for options related to backing up and replacing the Microsoft boot loader. Activate those options to continue the process. GRUB might or might not be able to launch Windows; that seems hit or miss -- and more "miss" if you leave Secure Boot active.
  • Do the job manually: From Linux, back up /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi (I recommend moving it down one level, to /boot/efi/EFI/Microsoft/bootmgfw.efi, rather than renaming it to bootmgfw.efi.bkp, since the latter is non-standard and makes tools other than Boot Repair and Ubuntu's GRUB unable to locate it). Copy /boot/efi/EFI/ubuntu/grubx64.efi in its place; or if you plan to keep Secure Boot working, copy /boot/efi/EFI/ubuntu/shimx64.efi in its place and copy grubx64.efi to /boot/efi/EFI/Microsoft/Boot using its original name. You'll then need to modify your GRUB configuration to enable it to launch the Windows boot loader in its new location or under its new name. (I've heard that GRUB can't yet launch the Windows boot loader in Secure Boot mode, though, so if you want to launch Windows from GRUB, you may need to disable Secure Boot. OTOH, I've never tried this myself, so I could be mistaken about GRUB's capabilities in this respect.)
  • Disable Secure Boot, then boot to Linux and install my rEFInd boot manager by using the Debian package. Once that's done, type sudo mvrefind.sh /boot/efi/EFI/refind /boot/efi/EFI/Microsoft/Boot. The latter command moves and renames files in a way that's analogous to the manual procedure I just described or to what Boot Repair does, but it sets up rEFInd as the default boot loader rather than GRUB. If you want to use Secure Boot, you'll be able to do so by juggling files and installing a new version of shim (Ubuntu's shim is early enough that it won't work properly with rEFInd). Installing rEFInd in this way enables you to boot without using GRUB, and the combination of the install script (executed by the package system when you install the Debian package) and the mvrefind.sh script work around the problems you're having.

For the record, the problems you're having are related to known bugs in HP's EFI implementation. Basically, the firmware is hard-coded to boot from Microsoft's boot loader and to make it difficult or impossible to boot from anything else. I strongly recommend you complain to HP about this; they won't fix such problems unless people complain.

Of the three solutions, using Boot Repair is likely to be the easiest to get working; but as I noted, the non-standard naming that Boot Repair uses can end up causing problems for other utilities in the future. The manual adjustments will require more effort to get working, but will be cleaner in the long run. Some people have reported problems getting GRUB to chainload the Windows boot loader, so either option could give you headaches on that score. rEFInd is much more likely to boot either Linux or Windows without problems, but as you can tell from the procedure, getting it working is likely to require a bit more effort than running Boot Repair again, although probably less than doing manual file-juggling. Using rEFInd in conjunction with Secure Boot requires more hoop-jumping at the moment. (See rEFInd's documentation for details.) rEFInd also presents a prettier user interface than GRUB, which might or might not be important to you.

There's risk involved in all three solutions; EFI implementations vary far too much amongst themselves, which means that either an automated or a manual procedure that works well on one computer can fail miserably on another. To protect yourself, I recommend backing up your ESP (normally /boot/efi under Linux); just pack the files up in a tarball or copy them to a backup directory. If something goes badly wrong, you can boot up with an emergency disc and restore the files. That will probably get the computer booting again.

Solution 4:

Hewlett-Packard's UEFI has been giving me heartache for a while. Your fix helped me to restart my HP laptop in GRUB again - without pressing F9 first.

I had one problem: after your fix, I could select Windows 8 in GRUB, but Windows 8 then refused to start and I was shown the GRUB menu again.

My fix:

  1. Copying the original Microsoft efi-file to /boot/efi/EFI/Microsoft/Boot/bootmgf2.efi
  2. Editing /boot/grub/grub.cfg to recognise the renamed Microsoft efi-file

Laptop now boots to GRUB, Ubuntu and Windows 8 now start OK from GRUB.