17

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)?

15

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 Mar 20 '13 at 18:07
  • @Nathan2055 Yes, like 7 to 8... new, higher versions of Windows. Windows Update will not affect the MBR. – Christopher Mar 20 '13 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 Mar 20 '13 at 18:13
  • As an alternative, you can try to configure the windows bootloader to chainload to grub: oreillynet.com/pub/h/2337 A little more involved and may be too much work for too little effect, but doing it that way makes it so if Windows does overwrite the bootloader, you'll still be able to boot into Linux. – Bratchley Mar 21 '13 at 12:46
  • @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 Mar 21 '13 at 14:51
3

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.

  • 1
    disabling the windows restore option seems to have fixed this issue for me. – DrCord Sep 7 '16 at 1:42
1

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

  • 1
    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. – Nathan Kidd Nov 1 '16 at 13:49
1

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
}
0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.