I've been reading a lot about dual-booting, and it seems as easy as loading Windows and then loading Linux with GRUB, but everybody says that Windows loves to trash GRUB when it gets the opportunity. What are some steps I can take to prevent this from happening (other than using Windows' bootloader, I want to keep this as simple as possible)?


8 Answers 8


Windows will overwrite the boot sector whenever you install it, upgrade it to a new version, or use tools like bootrec /fixmbr, bootrec /fixboot, or the older fdisk /mbr. In general, install Windows first, then Linux. The boot sector will stay put until you do one of the things above. (And perhaps there are also other ways to write onto the MBR.) But, if you lose GRUB, it is easily restored:

  • Boot from a live CD (CD/DVD or flash drive).
  • Become root or use sudo with commands below.
  • List the available partitions if needed: fdisk -l
  • Windows will almost certainly exist on /dev/sda1: mount /dev/sda1 /mnt
  • Reinstall GRUB in the MBR: grub-install --root-directory=/mnt/ /dev/sda
  • Reboot: shutdown -r now
  • Restore the GRUB menu: update-grub

You could also install 100% Unix, Linux, or BSD and simply run Windows in a virtual machine if the computer is strong enough for that.

Also: your computer's BIOS may have an option to protect the boot sector.

  • By upgrading, do you mean Windows 7 to Windows 8 or just running Windows Update?
    – Nathan2055
    Commented Mar 20, 2013 at 18:07
  • 1
    @Nathan2055 Yes, like 7 to 8... new, higher versions of Windows. Windows Update will not affect the MBR. Commented Mar 20, 2013 at 18:08
  • I thought so. The good thing is I doubt I will be messing with the MBR under Windows, and there is no way I am going to Windows 8 after reading this.
    – Nathan2055
    Commented Mar 20, 2013 at 18:13
  • @JoelDavis: Yeah, I've read several tutorials on doing that, but for someone who has absolutely no experience even loading GRUB and the fact that I don't think Windows will give me trouble, considering I don't want to upgrade, I think I will go with a vanilla GRUB setup and not mess with the bootloader.
    – Nathan2055
    Commented Mar 21, 2013 at 14:51
  • "Windows" here should be something like "Windows recovery environment" no? ... Just for clarity as Im doing this fix as we speak ... and there are a number of other "Windows" partitions ... but the specific one we want to overwrite is the Windows recovery environment.
    – carl crott
    Commented Sep 20, 2017 at 2:36

A solution I found somewhere online (unix.stackexchange.com) involves deactivating windows boot manager. Get into Linux (either the original install, if you can or live CD/DVD) and run this command:


Note that this method will only work if Linux has been installed in UEFI mode, so you'll get an error if Linux has been installed in Legacy mode. If you installed it in UEFI mode, you'll get some info and a list. You'll notice Windows boot loader/manager and Linux somewhere in the list. It's likely that Windows will have higher priority (boot order is above the list).

There are also stars* beside some, if not all, of the entries, marking them active.

Look at the 4 digit boot number next to Windows entry and run

sudo efibootmgr --bootnum #### --inactive

This will deactivate Windows entry. Also, make sure that now deactivated Windows has higher priority if it doesn't already:

sudo efibootmgr --bootorder ####,$$$$,&&&&,%%%%

where #### is Windows boot number.

If you reboot now, you'll boot to grub, if the Linux option is enabled with the highest priority.

Note that Windows doesn't seem to recognize that it's been deactivated, so this will not get reverted by booting into Windows or updating it.

I participated in a local Linux installfest where we install Linux for interested people, most often as a secondary OS next to Windows. I've yet to see this method fail, and I've tried it on several distros (mostly Ubuntu and Mint) and several vendors (Asus, Acer, HP, Lenovo).

  • "Also, make sure that now deactivated Windows has higher priority if it doesn't already:" why is this? It seems counterintuitive since we don't want to boot to Windows right? Does inactivating not work otherwise?
    – Kvothe
    Commented Apr 12, 2022 at 20:33
  • 2
    If Windows doesn't have the higher priority it will mess with the bootloader in order to get it. Since it's deactivated, you might as well give it higher priority to keep it complacent. Commented Apr 13, 2022 at 21:55

I did try a few of the good suggestions above to no avail. I think MS have gotten even trickier.

What worked for me now in 2021 was following the advice listed in the boot-repair summary which suggested to boot into Windows and run the following in a command prompt (I needed to run command as admininstrator to get it to work)

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

Note: the command above is tailored to my circumstance of UEFI secure boot, so if you want to follow this method then you'll need to run boot-repair and make note of their suggested fixes.

Instead of running boot-repair you can also use the following command in Linux to get the correct efi path (you might need to install it and/or use a live-usb if you cannot access your Linux distro):

efibootmgr -v

After running the bcdedit command in Windows I always get the grub menu and if I boot nto Windows it doesn't seem to clobber my grub and on a restart I get the grub menu again with Linux as the default. It's a beautiful thing,

  • No way! This works miracles. I had refind installed and recently windows boot manager erased all the options. Now it will always go through refind
    – John K
    Commented Oct 8, 2023 at 21:17
  • A bit light on the explanations, but following this, it actually worked.
    – DarkNeuron
    Commented Dec 7, 2023 at 17:37

I think I will go with a vanilla GRUB setup and not mess with the bootloader.

If you use any form of grub, you are messing with the boot loader. GRUB stands for "grand unified bootloader". And there are two versions -- grub v1 adn grub v2. All modern linux systems use grub2 automatically. If you install any linux system, grub is the default bootloader unless you specifically go with LILO, which I would not suggest.

I personally have a dual boot system with xp and Wheezy. I keep xp from over writing grub by disabling "windows restore" option.

Before I disabled the restore option, I would have to fix grub at least once a week as windows bootloader kept overwriting grub.

I am fixing to install windows 8 on an external hard drive through a usb port. I am hoping this goes without a hitch and doesn't mess with my mbr.

  • 2
    disabling the windows restore option seems to have fixed this issue for me.
    – DrCord
    Commented Sep 7, 2016 at 1:42

This is a workaround I use, it works with Windows updates with no intervention required: Rename your EFI/Microsoft in EFI/Microsomething Replace Windows Boot Path in grub.cfg to EFI/Microsomething/bootmfgw.efi Like this:

menuentry "Microsoft Windows UEFI-GPT" {
    insmod part_gpt
    insmod fat
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --set=root <PROVIDE YOUR EFI DRIVE UUID>
    chainloader /EFI/Microsomething/Boot/bootmgfw.efi

Windows 10 overwrites GRUB 2 when you change the text color, size, font, or menu entry titles.

There are two ways to solve this.

  1. You could install Linux in Legacy Mode (BIOS Settings > Boot > Legacy Support + Legacy First).

  2. You could turn OFF Windows restore (a.k.a. System Protection) (Control Panel > System & Security > System > System Protection > Configure > Disable).


Just open gparted , right click the partition that has Grub in it, go to manage flags and mark boot.

  • 2
    This may work if the Windows install merely changed the boot partition. In my case The Windows 8.1 install overwrote the MBR, requiring Christopher's grub-install solution. Commented Nov 1, 2016 at 13:49

Use boot-repair as shown in https://help.ubuntu.com/community/Boot-Repair.

I used a Bootable USB and followed the instructions on "2nd option".

Basically what happened to me is that I replaced my SSD with a new one, installed Windows and therefore has no GRUB in it. Also, specifically I have Ubuntu 22.04 installed on another HDD and boot-repair did the repairs.

  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jul 7, 2023 at 23:58

You must log in to answer this question.

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