How can I keep Windows 7 64-Bit from interfering with the UEFI sequence upon every restart?

Answered How can I keep Windows 7 64-Bit from interfering with the UEFI sequence upon every restart?

  • Tuesday, June 12, 2012 8:39 AM
     
     

    This is a copy of a thread on the Microsoft answers forums where I first posted this. Another member told me it'd be better to post it here instead.


    Hi all,

    I've set up a new computer with UEFI using the GPT partitioning scheme. As I'm dual-booting into Linux, I want to use grub as the boot manager, which works fine to boot both Linux- and Windows-installation.

    My only problem is that whenever I start Windows 7 64-Bit, it automatically changes the EFI boot sequence to put its own boot manager at the top. How can I stop it from doing so?

    I already got a suggestion to install a Linux bootloader into the MBR of one partition, then use the Windows bootloader to boot that. As I'm using a GPT partitioning scheme, I fear Windows might get confused over that. When I first installed the computer with a new SSD, Windows 7 wouldn't install or boot if I still had the MBR-partitioned HDD attached. I was only able to fix it by converting the HDD to a GPT partitioning scheme via Linux.
    Some information:

    • OS: Windows 7 Home Premium 64-Bit
    • Mainboard: ASRock Z77 Pro 3 (upgraded to most recent UEFI version)


    Any help is greatly appreciated.

    Kind regards,

    Timo

All Replies

  • Thursday, June 14, 2012 9:52 AM
    Moderator
     
     

    Hi,


    Based my research, Windows 7 loader may not be able to remove. The Windows system option in GRUB should be shown as “Windows 7 (loader)”. It means after you select Windows 7 to boot, its boot management still launch.


    You may consider to contact GRUB support team directly.

    https://lists.gnu.org/mailman/listinfo/help-grub


    Kim Zhou

    TechNet Community Support

  • Thursday, June 14, 2012 3:10 PM
     
     

    Hi Kim and thanks for your answer,

    I think you may have misunderstood me, though. Again, Windows 7 boots fine when selected from the grub menu, no problem there. The problem is that every time I do boot into Windows 7, it automatically changes the EFI boot order, meaning that the next time I boot, grub won't show up. Instead, Windows 7 will be booted automatically, i.e. it is the first entry in the EFI boot options list then.

    It doesn't matter whether I change back the order via Linux (efibootmgr) or directly in the EFI setup. I doubt this is a problem with grub, because as long as I use grub to boot into Linux, the EFI boot order stays the same.

    Kind regards,

    Timo

  • Friday, June 15, 2012 9:28 AM
     
     

    1. Which linux system are you using?
    2. How did you try to change the boot order before in linux, change the grub menu list file?
    3. What you have tried in Windows 7?

    Based on my experience, if we install Windows and Linux on the same machine, usually we should install windows first, then install linux, then the boot loader used would be the Grub. So we usually change the boot order from linux, not windows.

    Also I suggest that you can submit a post in the linux forum at the same time, such as the Ubuntu forum. There are a lot of experts for Grub as far as I know.


    Thanks
    Zero

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Friday, June 15, 2012 1:50 PM
     
     

    Hi Zero Xia,

    1. I'm using Archlinux.
    2. In Linux, I change the boot order via the efibootmgr command. Calling the command without arguments yields (among other information) the currently available EFI boot options, the currently booted one and the order in which they're tried. The -o argument allows me to change the order. Using this tool has the same effect as changing the order in the EFI setup (accessible during boot via F2 on my board).
    3. I don't know how to manually change the EFI boot order in Windows 7. I fiddled around with bcdedit to configure the Windows 7 boot manager to allow me booting Linux from there.

    Once again, I doubt asking the Linux community will help me solve my problem as Linux and grub are not the problem here.

    Kind regards,

    Timo

  • Friday, June 15, 2012 6:53 PM
     
     

    Hi Zero Xia,

    1. I'm using Archlinux.
    2. In Linux, I change the boot order via the efibootmgr command. Calling the command without arguments yields (among other information) the currently available EFI boot options, the currently booted one and the order in which they're tried. The -o argument allows me to change the order. Using this tool has the same effect as changing the order in the EFI setup (accessible during boot via F2 on my board).
    3. I don't know how to manually change the EFI boot order in Windows 7. I fiddled around with bcdedit to configure the Windows 7 boot manager to allow me booting Linux from there.

    Once again, I doubt asking the Linux community will help me solve my problem as Linux and grub are not the problem here.

    Kind regards,

    Timo

    Your assumption is most probably extremely wrong.

    You installed the GRUB software and if you have any problems with it, it is not a Windows 7 problem.

    It is a GRUB problem!!!

    If you did not have GRUB the hard drive Windows 7 would not interfere with the UEFI boot at all!


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • Saturday, June 16, 2012 3:23 AM
     
     

    Hi Zero Xia,

    1. I'm using Archlinux.
    2. In Linux, I change the boot order via the efibootmgr command. Calling the command without arguments yields (among other information) the currently available EFI boot options, the currently booted one and the order in which they're tried. The -o argument allows me to change the order. Using this tool has the same effect as changing the order in the EFI setup (accessible during boot via F2 on my board).
    3. I don't know how to manually change the EFI boot order in Windows 7. I fiddled around with bcdedit to configure the Windows 7 boot manager to allow me booting Linux from there.

    Once again, I doubt asking the Linux community will help me solve my problem as Linux and grub are not the problem here.

    Kind regards,

    Timo

    Your assumption is most probably extremely wrong.

    You installed the GRUB software and if you have any problems with it, it is not a Windows 7 problem.

    It is a GRUB problem!!!

    If you did not have GRUB the hard drive Windows 7 would not interfere with the UEFI boot at all!


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

    Thanks for your information, Rick.

    @The Isz,
    Based on my personal experience, after we installed Linux, Grub becomes the default boot program(not sure if this is really correct saying), if we delete linux later, we can't boot into Windows. That means when in Windows and Linux dual boot, the primary master is the linux.

    Another suggestion, check if any updated versions of UEFI for your machine and engage the hardware vendor to check if they have enough test when using Linux on their hardware.

    I haven't so much experience with Archlinux. If I'm wrong, please feel free to correct me. Thanks.


    Thanks
    Zero

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Saturday, June 16, 2012 9:35 AM
     
     

    Hey guys,

    look, I don't want to fight with you. If I came on too strong with my suspicion that it's not a Linux or grub problem, let me say I'm sorry for that.

    Regarding your suggestions, I have a feeling that you don't really understand how a UEFI/GPT system works. Again, I don't intend to offend you by this! I probably should have added more information as (U)EFI isn't very wide-spread yet.

    Here's what I gathered so far (the topic is relatively new to me, too):

    My SSD has a ~100Mb Fat partition (the EFI partition) at its beginning. There, all operating systems can store their bootloaders and UEFI will read this partition for bootloaders upon boot. In my case, Linux' grub and Windows 7's bootloader are located there. Repeating, they are both there and working. I can choose in what order these bootloaders are tried during boot, both from the UEFI setup and from Linux using the earlier mentioned efibootmgr tool.

    When Windows 7 starts, it does not delete or interfere otherwise with grub, neither does it reinstall or change its own bootloader located in the EFI partition. The same accounts for grub: When it is installed, it does not change or delete the Windows 7 bootloader located on the EFI partition.

    Now again, my problem is that Windows 7 automatically changes the order in which these bootloaders are tried automatically upon every start. Can you now see why I assume this has nothing to do with Linux or grub? It doesn't touch grub at all, it just touches EFI, nothing else.

    Kind regards,

    Timo

  • Tuesday, June 19, 2012 1:38 PM
     
     
    Have you checked if changing the settings inside Windows 7 will work?
    I also can't under what you mean by saying "Windows 7 automatically changes the order in which these bootloaders are tried automatically upon every start", do you mean the default OS will be changed at every reboot?

    Thanks
    Zero

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Tuesday, June 19, 2012 5:19 PM
     
     

    Hi Zero Xia,

    if you tell me how I can change the EFI boot sequence from within Windows 7 I will gladly try. Personally, I haven't found a way to do that. All I could find was the bcdedit tool, but that one only modifies the Windows 7 bootloader, not the EFI boot sequence.

    If I set grub as the first EFI boot option, it will be used upon the next boot. After I start Windows 7 through grub, it will be booted automatically on the next boot, grub won't show up at all then.

    Kind regards,

    Timo

  • Wednesday, June 20, 2012 10:10 PM
     
     Answered

    Hi all,

    I finally found a workaround for this problem here. It's not elegant, but at least it works:

    1. Rename the windows bootmanager's EFI file:

      mv EFI/Microsoft/Boot/bootmgfw.efi EFI/Microsoft/Boot/bootmgfw.efi.old

    2. Copy grub's efi file into that place:

      cp EFI/arch_grub/grubx64.efi EFI/Microsoft/Boot/bootmgfw.efi

    3. Finally, adapt your grub.conf so that the Windows entry refers to EFI/Microsoft/Boot/bootmgfw.efi.old instead of EFI/Microsoft/Boot/bootmgfw.efi

    This way, Windows can think it's the first entry in the EFI boot sequence all it wants, grub will be used anyway. And using grub, I can now choose to boot Linux or Windows, just as I wanted.

    Thanks to everyone for their help. If you have a better solution than this, please feel free to post it and I'll check if it works.

    Kind regards,

    Timo

    • Marked As Answer by The Isz Wednesday, June 20, 2012 10:10 PM
    •  
  • Friday, July 20, 2012 2:25 PM
     
     

    I have a slightly different variation of the same problem,

    Have a Sony VAIO S laptop with Insyde H20 BIOS, which insists on booting EFI/Microsoft/Boot/bootmgfw.efi EFI/Microsoft/Boot/bootmgfw.efi if one exists.  Since I want to dual-boot, I overwrote it with a different boot manager (in my case, rEFInd, but might as well be GRUB, doesn't matter), and put bootmgfw.efi in a different place.  This worked quite well, until Windows 7 self-installed Service Pack 1.  After that, each time I hibernate, Windows overwrites (!!) bootmgfw.efi to put its own back.  Seems like a case of OCD on its part (unless this overwriting is done by some security program?)

    So, originally posted question remains - how do I keep Windows from touching the UEFI files without explicitly being told to do so?

  • Friday, July 20, 2012 6:05 PM
     
     
    Oh my God... Do I really need to keep Win7 from installing updates now!?
  • Tuesday, October 23, 2012 6:15 PM
     
     

    Hi,

    I came here hoping to find the solution to this problem and did not, but I found it somewhere else so I'm just going to share it for the few people that would get here from searching the magic keywords on Google, just as me.

    So all you have to do is open a command prompt window in administrator mode (right click), then type the following:

      bcdedit /set {bootmgr} path \EFI\boot_app_dir\boot_app.efi

    For example, if you use Ubuntu through the GRUB bootloader:

      bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

    That way Windows Boot Manager will still be put on top of the boot list whenever you run Windows 7, but it will automatically chainload to the specified application when booting, so you will not notice anything unless you look at the UEFI boot order.

    Solution found thanks to: http://www.rodsbooks.com/refind/installing.html

    Have fun!


    • Edited by Dentuk Tuesday, October 23, 2012 6:16 PM
    •