0

I'm a linux novice trying to get a windows/ubuntu dual boot working. I can access both OSs ok, but only by navigating through a series of strange BIOS menus for Ubuntu (Windows boots automatically). Grub does not start initially, which is what I'm trying to fix.

I've successfully partitioned my drive for Windows 7 Home Premium and Ubuntu 14.04.1 LTS. I have a HP-250 G1 laptop.

I installed Windows first (on a 200 GB partition), then gave the rest of my drive to Ubuntu (500 Gb, ext4). I made partitions for swap (6500Mb) and biosgrub (1 Mb) when installing Ubuntu.

When I start my laptop, Windows boots automatically, without giving any options for Ubuntu. The only way to boot Ubuntu is to restart the computer, open the Startup Menu, go to Boot Device Options and choose ubuntu (TOSHIBA MQ01ABD075), which starts grub and allows me to boot into Ubuntu.

I have tried using EasyBCD to get the Windows Bootloader to recognise Ubuntu, but I get an error along the lines of Failed to initialize properly. Annoyingly, the Windows Bootloader always pops up now, even if I delete the Ubuntu pointer.

I have tried to use the Ubuntu Boot-Repair, the output was this http://paste.ubuntu.com/9604542/

I tried entering the following command into an administrator command prompt bcdedit/set{bootmgr}path\EFI\ubuntu\shimx64.efi as recommended by the boot-repair, but complains An unknown command was specified (EDIT)

So, long story short, I'd just like grub to start up when I boot up my laptop. Any help would be really appreciated!!

7
  • 1
    EasyBCD often just complicates things with UEFI boot. I thought the bcdedit just would work? But many with HP have found they rename /EFI/Boot/bootx64.efi and copy grubx64.efi to be bootx64.efi and create or boot the hard drive entry in UEFI menu. You may have to set hard drive as first with efibootmgr.
    – oldfred
    Dec 23, 2014 at 18:07
  • @oldfred The bcdedit command given by boot-repair complains unknown command was specified. Under C:\Windows\Boot\EFI I do not have the file bootx64.efi
    – jaryaman
    Dec 23, 2014 at 20:48
  • Then create in the efi partition /EFI/Boot folder and just copy grub into it and rename to bootx64.efi. Command to copy from is different if booted as fstab mounts as /boot/efi/EFI/ubuntu or if live installer which path you use to mount it. Can you boot wiht work arounds, now?
    – oldfred
    Dec 23, 2014 at 21:40
  • @oldfred From Ubuntu, I copied /boot/efi/EFI/ubuntu/grubx64.efi onto a USB, and transferred it onto my windows partition. I renamed it to bootx64.efi and copied it into C:\Windows\Boot\EFI. No change in behaviour. Apologies if I misinterpreted your instruction.
    – jaryaman
    Dec 23, 2014 at 22:24
  • No, it needs to be in the efi partition. Not sure what c:\Windows folder is? You want it as /boot/efi/EFI/Boot/bootx64.efi but really be the grubx64.efi. If UEFI has hard drive entry then you can boot that, or may have to use efibootmgr to register the new entry.
    – oldfred
    Dec 23, 2014 at 22:28

1 Answer 1

1

I will try to answer my own question. Apologies if my use of technical terminology is wrong. Aim: To get Ubuntu to boot as default, and allow me to boot Windows by playing with BIOS.

I believe the problem is the EFI on my machine does not allow me to boot from anything but /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi, see here for a discussion of this. The following is a work-around for users who mainly use Ubuntu, but sometimes want to boot into Windows. My expectation is that this is mainly of relevance to HP-users, from accounts on the internet.

1) Install Windows, and then Ubuntu, see here

2) Restart the computer. If windows automatically boots then try using efibootmgr to give Ubuntu precedence, see here. If this works, you're done so stop reading.

3) If your computer is like mine, no matter what you do in efibootmgr, Windows will always force itself first. Changes you make will be undone when you restart the computer. In this case, the following hacks work for me.

4) Restart your computer, quickly press esc and go into the Boot Manager. There should be an option to start Ubuntu, choose that and launch Ubuntu.

5) Start a console and backup the important bootmgfw.efi to allow a boot to Windows

$ sudo -s
# cd /boot/efi/EFI/Microsoft/Boot
# cp bootmgfw.efi ./.. 

6) Create a new boot number, so we can boot up Windows in a hacky way by linking to the backup of bootmgfw.efi we just made. Run

# efibootmgr -c -L "Windows_2" -l "\EFI\Microsoft\bootmgfw.efi"
# efibootmgr -v

Use the last command to check the new entry was made. At this point I recommend you restart the PC and check booting into Windows_2 does indeed boot Windows. After you've done that, boot Ubuntu and cd back into /boot/efi/EFI/Microsoft/Boot

7) Renaming grubx64.efi to bootmgfw.efi allows us to boot Ubuntu first. Now enter the following commands:

# cp ../../ubuntu/grubx64.efi .
# cp bootmgfw.efi bootmgfw_backup.efi
# rm bootmgfw.efi
# cp grubx64.efi bootmgfw.efi

This should now work. Restart your machine.

Expected behaviour: Upon booting the PC, grub should open up as the default, allowing you to launch Ubuntu. Trying to launch Windows from grub will just link you back to grub in a never-ending loop. To launch windows, you must restart the computer, quickly press esc and go into the Boot Manager. Select Windows_2 and that will launch windows.

Hacky but it works so far. I will update the post if it turns out this ruins my computer.

2
  • Many thanks to @oldfred for his contributions to this
    – jaryaman
    Dec 24, 2014 at 17:06
  • I thought HP & others (which may be different) checked for "Windows Boot Manager", but at least in your case it must be just checking for "Windows" in the Description field of UEFI entry. Good to know.
    – oldfred
    Dec 24, 2014 at 18:58

You must log in to answer this question.

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