FedoraForum.org - Fedora Support Forums and Community
Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2004
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to set grub as default boot loader

    I just got an HP Envy dv7 series laptop which came with Windows 8. I used Windows tools to remove the recovery drive and shrink the main windows partition to make room for Fedora 18. The installation process for Fedora went reasonably smoothly and I now have a system with a working Fedora and Windows 8 both booting with Secure Boot enabled. The problem is that I want Fedora to be the default OS, not Windows.

    At the moment to boot to Fedora, I have to hit F9 at system startup which brings up a menu that allows me to select the Fedora partition to boot from. I thought that I would be able to select the boot order in the main BIOS but the boot order options only list "OS Boot Manager", the optical drive, usb and network options but no Fedora option.

    Is there any way to tell the system that I want to boot from the Fedora partition and not the Windows partition? Note that the HP comes with InsydeH2O BIOS.

    If it's not possible to do this, I presume that it should be possible to add Fedora to the Windows boot manager with it as the default. My concern with that is that in the old legacy boot world, every time the kernel got updated, I would have to copy the first 512 bytes of the boot partition to Windows so that the Windows boot manager could boot Linux. I have no idea what, if anything, would be necessary in the secure boot world.

    Any help greatly appreciated.

    Thanks,
    Dan.

  2. #2
    Join Date
    May 2009
    Location
    /dev/ph
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Use the efibootmgr tool in Fedora 18 to select the default boot device.

  3. #3
    Join Date
    Dec 2010
    Location
    Burgos-Spain
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    ¡Hola!
    In Fedora 17 I did:

    I wrote in a terminal:
    $ sudo grub2-install /dev/sda
    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

    And in the next start I could select any one of the OS installed on my PC.

    Saludos

  4. #4
    Join Date
    Jun 2004
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Unfortunately, using grub2-install and grub2-mkconfig did not work on my system. Running those commands actually left me unable to boot to Fedora with this message:

    Selected boot image did not Authenticate

    I assume that something was missing so that the Secure Boot checks failed.

    Using efibootmgr also does not work. It looks like the firmware restores the original settings on reboot much like the behaviour discussed in this post:

    http://askubuntu.com/questions/15017...-into-grub-efi

    If I follow the suggestion in that post, then I should replace EFI/Microsoft/boot/bootmgfw.efi

    on the Windows EFI system partition (ESP) with an efi file from the Fedora ESP. The only problem is that the Fedora ESP contains 5 efi files and it's not obvious which one should be used to replace bootmgfw.efi:

    gcdx64.efi
    grubx64.efi (seemingly the most likely option)
    MokManager.efi
    shim.efi
    shim-fedora.efi

  5. #5
    Join Date
    Dec 2010
    Location
    Burgos-Spain
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    ¡Hola!
    I deeply regret what has happened to you, but don´t get discouraged.
    I recently had a lot of problems at starting. The cdrom of supergrub2 was my salvation.
    Unfortunately I cannot help you with the efi files.
    Please, read in this forum my SOLVED thread
    ICannot start Windows XP from Grub2 F17
    , maybe it could help you.

    Saludos

  6. #6
    Join Date
    Jul 2009
    Posts
    1,234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Generally when you install Linux (Fedora), it will install GRUB by default. GRUB will give you a boot menu to choose the OS. To change the default OS to boot, you edit /etc/default/grub and change the value in there (probably from 0 to 1). The first OS listed will be 0, the second will be 1, etc.
    Code:
    set default=1
    then rebuild grub.cfg with the command:
    Code:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    Reboot.
    Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)

  7. #7
    Join Date
    Jun 2004
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Hi, David.

    Actually, grub isn't the problem. Grub2 was properly installed by Anaconda and the computer boots just fine to Fedora but I have to manually go through the BIOS and select the boot partition. Running grub2-install and grub2-mkconfig, as I mentioned above, makes Fedora unbootable from the BIOS menu which is interesting because when the kernel is updated, grub2 is properly updated; I don't know what the update script is doing differently to update grub.

    From everything I've read, the proper way to do what I want is to use efibootmgr. The output from efibootmgr is

    Code:
    BootCurrent: 0003
    Timeout: 0 seconds
    BootOrder: 3000,3003,2001,2002,2003
    Boot0000* Windows Boot Manager
    Boot0003* Fedora
    Boot2001* USB Drive (UEFI)
    Boot2002* Internal CD/DVD ROM Drive (UEFI)
    Boot3000* EFI Internal Hard Disk or Solid State Disk
    Boot3003* EFI Internal Hard Disk or Solid State Disk
    I can use

    Code:
    efibootmgr -o 3003,3000,2001,2002
    to change the boot order but when I reboot the system, it still boots to Windows. Rebooting to Fedora and running efibootmgr shows that the original boot order was restored which implies to me that the firmware is forcing Windows to be the default OS by overwriting any changes to the boot configuration.

    I've tried to add Fedora to the Windows 8 bootloader with EasyBCD but there's a problem with that as well. I can add the Fedora entry and when the system boots I get a menu including Windows 8 and Fedora but Windows 8 is still the default and, on top of that, Fedora won't boot. The system gives an error to the effect that "Windows can't be loaded". I'm certain that there must be a way to do it but I haven't figured it out yet.

    My options, at the moment, seem to be

    1. Wipe out Windows altogether and make this a Linux only system
    2. Live with it and remember to hit F9 when booting up

    While I do want Linux as my primary OS, I don't really want to wipe out the Windows that came with the laptop. Option 2 isn't great either but the fact the I can just close the lid of the laptop to put it to sleep rather than shutting down makes it at least somewhat manageable.

    Dan.

  8. #8
    Join Date
    Jul 2009
    Posts
    1,234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Do you ever see the GRUB menu? Does Windows show up on the GRUB menu? If so, you should be able to edit GRUB to select which OS to boot.

    If you are booting more than one hard drive, then other issues come to play, however I am booting 2 hard drives successfully.

    My system:
    Drive A: Windows 7, Arch XFCE, Fedora 18 Gnome, & Mageia 2 KDE
    Drive B: Windows 8, Bodhi 17 Enlightenment

    I have GRUB2 installed on Drive A (from Arch). I have Windows 7 as the default OS to boot (3rd boot entry). I can boot everything from Arch's GRUB menu except Windows 8, because Windows 8 was installed when only one hard drive was in the laptop.

    I have GRUB2 installed on Drive B (from Bodhi). I can boot Bodhi or Windows 8 if only drive B is in the laptop.
    EDIT: I forgot. I can boot Windows 8 (and Bodhi) from drive B with drive A in the laptop if I use the BIOS boot menu.

    I am using configfile to boot other instances of GRUB from the Primary GRUB (see: https://bugzilla.redhat.com/show_bug.cgi?id=872826#c23 ).

    I've heard a little about EFI, but don't really know much about it. I am not using it. I am using a BIOS setup.

    Maybe this Arch Wiki will help some. Just realize that some of the commands may have to be modified for Fedora (for instance when the path of a file is slightly different).

    https://wiki.archlinux.org/index.php/GRUB2
    Last edited by David Batson; 18th February 2013 at 04:18 AM.
    Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)

  9. #9
    Join Date
    Jun 2004
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    Yes, of course I've seen the grub menu otherwise I wouldn't be able to boot to Fedora. And the grub does, indeed, include an entry for Windows from which I can boot to Windows.

    The problem is that the only way that I can get to the grub menu is to enter the BIOS (well, technically, it's not BIOS but UEFI firmware) by, in my case, hitting F9 to get a list of bootable partitions. From there I can select the Fedora partition which then displays the grub menu. The firmware refuses to allow me to specify which partition should be used to boot and forces the Windows partition.

    For all I know, when Fedora was installed, Anaconda called "efibootmgr -o", or equivalent, to try to set grub as the default bootloader but the setting was overridden by the firmware.

    I am only using a single hard drive with Windows 8 and Fedora on it. I am wondering how you are booting to Windows 8 if you are not using UEFI since I was under the impression that Windows 8 would refuse to boot if UEFI's Secure Boot is not enabled.

  10. #10
    Join Date
    Jul 2009
    Posts
    1,234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    My X220 is pre-Windows 8 - it's about 2 years old. This X220 has a UEFI bios and supports that, but it also allows booting in Legacy mode (bios mode). When I got the X220, it was set up by the factory to boot in Legacy mode. I never changed that.

    I installed Windows 8 from an Upgrade DVD, as my Windows 7 installation met the prerequisites. I am not using Secure Boot. AFAIK, Secure Boot is not, and will not be, a feature of the X220.
    Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)

  11. #11
    Join Date
    Jun 2004
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set grub as default boot loader

    So I have partially solved my problem. By applying the information found here, I was able to set Grub as my default boot loader.

    Specifically, I did this:

    1. mv <MS-ESP>/EFI/Microsoft/Boot/bootmgfw.efi ..
    2. mv <MS-ESP>/EFI/Boot/bootx64.efi bootx64.efi.old
    3. cp /boot/efi/EFI/fedora/shim.efi <MS-ESP>/EFI/Boot/bootx64.efi

    The only problem is that I was mistaken when I said that the Windows entry in Grub allowed me to boot to Windows. It doesn't. I get a "can't find command: 'drivemap'" error. So far nothing that I've found on the web for configuring grub to boot Windows EFI has worked. It is, however, still possible to boot to Windows by jumping through some firmware hoops but that's ok since my primary goal was to get Fedora as the default OS.

Similar Threads

  1. Rebuilding the Grub Boot Loader on Master Boot Record (MBR) w Fedora Linux
    By Vector in forum Guides & Solutions (Not For Questions)
    Replies: 6
    Last Post: 1st August 2009, 08:39 AM
  2. Fedora9 boot - alternate boot loader Bing + grub
    By jadube in forum Installation, Upgrades and Live Media
    Replies: 1
    Last Post: 24th May 2008, 03:01 AM
  3. Grub boot loader issues? (stupid grub!)
    By Cooldan1 in forum Installation, Upgrades and Live Media
    Replies: 5
    Last Post: 30th July 2007, 02:10 AM
  4. FC6 and GRUB and NT Boot Loader and then nothing...
    By jaminJay in forum EOL (End Of Life) Versions
    Replies: 3
    Last Post: 30th October 2006, 02:58 PM
  5. GRUB boot loader r windows boot loader?
    By Rebels Mascot in forum Using Fedora
    Replies: 4
    Last Post: 12th May 2005, 03:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •