I'm dual booting Win7 and Mint 13 on two (mostly) separate HDDs, Windows on the primary/SDA and Mint on the secondary/SDB. Each OS has its HDD exclusively to itself, except for the grub loader files that are on the 100mb Win7 boot manager partition, which is SDA1.
Well, a turf war broke out, which seems to have happened with every Windows/*NIX dual boot I've ever run, and naturally Windows hosed grub and nothing would boot. I fixed it by 1) running a boot sector repair on Win7 ("bootsect /nt60 c:"), 2) running Ubuntu's boot-repair, and 3) manually editing the grub.cfg file to add back the missing Win7 menu selection.
Is there a method for safeguarding the files in the Windows boot manager partition so they can be restored the next time this occurs without having to turn so many backflips? Would it work, for instance, if I were to boot from a *NIX thumb drive and do something like "dd if=/dev/sda1 of=/tmp/win7bootsect.image", then restore that image the next time this happens? I'd prefer to use some common *NIX command line tool but I'm open to suggestions. Since the grub files are proving to be the more troublesome to restore, and believing that grub's files are best managed from a *NIX environment, I have not looked into the possibility that there also might be a Windows solution, but is there one? It would increase my comfort zone to have options for potential fixes that will work in either environment, because you can never tell what Windows might break next.
How to safeguard grub in a dual boot?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
How to safeguard grub in a dual boot?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How to safeguard grub in a dual boot?
First, as you have Windows on one disk and Mint on another, you should really install Grub to the MBR of the Mint disk and leave the Windows disk alone. Then set your BIOS to boot the Mint disk first. This also allows you to independently boot Windows if something goes wronmg with Grub or Mint, or if you choose to delete Mint.
To achieve this, boot Mint. Open a terminal and run:
sudo dpkg-reconfigure grub-pc
and choose the disk for Grub that Mint is on, eg: sdb (not sdb1 or sdb2 or any other name ening in a number!)
Second, it is not Windows' fault. Windows uses a standard MBR that the Grub bootloader does not support properly. This is why Grub overwrites the standard MBR code. When Windows reinstated the normal MBR code it is trying to stick to the standards and help make sure you system is not corrupt. Grub should never be installed to a Windows partition like sda1 because it overwrites Windows' partition boot code, which is a big no-no.
To achieve this, boot Mint. Open a terminal and run:
sudo dpkg-reconfigure grub-pc
and choose the disk for Grub that Mint is on, eg: sdb (not sdb1 or sdb2 or any other name ening in a number!)
Second, it is not Windows' fault. Windows uses a standard MBR that the Grub bootloader does not support properly. This is why Grub overwrites the standard MBR code. When Windows reinstated the normal MBR code it is trying to stick to the standards and help make sure you system is not corrupt. Grub should never be installed to a Windows partition like sda1 because it overwrites Windows' partition boot code, which is a big no-no.
Re: How to safeguard grub in a dual boot?
Funny you should say that. My original plan was to do BIOS-controlled dual boot, but someone who convinced me he knew better than I also convinced me that Grub2 was not susceptible to this little problem. So I'd forgot about it. Thanks for reminding me.
So I followed your directions, thanks for that bit, too, but it still booted to the grub menu, regardless which HDD I selected to boot from in BIOS. So I used the Win7 repair disk to run boot sector repair on the Windows HDD. Now if I select sda in BIOS, it boots to Windows as per normal, with no grub menu. But if I choose sdb in BIOS, it boots to the grub menu, which still offers Win7 as one of its selections. And if I select Win7 from grub, it still boots it fine.
So I reckon there still is some "connection" between the two HDDs that wasn't broken. So can I altogether get shut of the grub menu, and what must I do to eliminate the last connection(s) between the two HDDs?
So I followed your directions, thanks for that bit, too, but it still booted to the grub menu, regardless which HDD I selected to boot from in BIOS. So I used the Win7 repair disk to run boot sector repair on the Windows HDD. Now if I select sda in BIOS, it boots to Windows as per normal, with no grub menu. But if I choose sdb in BIOS, it boots to the grub menu, which still offers Win7 as one of its selections. And if I select Win7 from grub, it still boots it fine.
So I reckon there still is some "connection" between the two HDDs that wasn't broken. So can I altogether get shut of the grub menu, and what must I do to eliminate the last connection(s) between the two HDDs?
Re: How to safeguard grub in a dual boot?
There is no "link" that's just how grub is supposed to work and was the solution he was recommending you.
The method you have now prevents you from having to bios switch each time as long as Mint is the first boot option (usually ideal add you want to mess with BIOS as little as possible)
This method still completely safeguards windows because in the event you do break Linux/want to remove it, THEN you just switch bios back to booting the windows drive first.
In essence, the windows drive is completely unaware that Linux or grub even exist and runs truly independent of both. Grub on the other hand sees both and allows you too safely boot either which is why it should be the primary.
The method you have now prevents you from having to bios switch each time as long as Mint is the first boot option (usually ideal add you want to mess with BIOS as little as possible)
This method still completely safeguards windows because in the event you do break Linux/want to remove it, THEN you just switch bios back to booting the windows drive first.
In essence, the windows drive is completely unaware that Linux or grub even exist and runs truly independent of both. Grub on the other hand sees both and allows you too safely boot either which is why it should be the primary.
Re: How to safeguard grub in a dual boot?
I would say that means that GRUB is friendly, Windows is not!Argy-Bargy wrote:Now if I select sda in BIOS, it boots to Windows as per normal, with no grub menu. But if I choose sdb in BIOS, it boots to the grub menu, which still offers Win7 as one of its selections. And if I select Win7 from grub, it still boots it fine.
However, if you do NOT want to see the Windows partition from GRUB, you may exclude it here:
Menu -> Control Center -> System/Grub Customizer
Mint rules! (20.1 MATE) Cinnamon go home! :)
Re: How to safeguard grub in a dual boot?
Excuse me being thick about this but if grub can "see" the Windows partitions, and can cause Win7 to boot, how can there not be some remaining "connection" between them, which is to say, grub/Mint still maintaining files on the Windows HDD?
And how do I stop the grub menu appearing altogether, just turn the menu timing to zero? Is there no other way to cause it to boot straight to Mint?
And how do I stop the grub menu appearing altogether, just turn the menu timing to zero? Is there no other way to cause it to boot straight to Mint?
Re: How to safeguard grub in a dual boot?
I have two computers, a desktop and a laptop, and I have a Windows 7/Linux dual boot set up on both. To avoid conflicts or that thing where Windows overwrites GRUB, (which it WILL do) I just use BCD (the Windows bootloader) as my main bootloader. When I'm installing Mint, (or any other Linux distribution) I just install grub to the / partition and leave BCD on the MBR. I then go into Windows and add an entry to BCD so that it will "find" the Linux operating system(s) and boot them as it should. These days, modifying BCD is really simple, there are GUI tools like EasyBCD which will allow you to do it. This solution works no matter how many discs you're using.
http://neosmart.net/EasyBCD/ (I use the free version)
http://neosmart.net/EasyBCD/ (I use the free version)
Re: How to safeguard grub in a dual boot?
The Windows partition is self-booting. That is to say, it contains bootstrap code in its first sector. All Grub needs to know is where that sector is. Grub then passes control to it and that's it. This is called "chainloading".Argy-Bargy wrote:Excuse me being thick about this but if grub can "see" the Windows partitions, and can cause Win7 to boot, how can there not be some remaining "connection" between them, which is to say, grub/Mint still maintaining files on the Windows HDD?
By default, the Mint installer does not make Mint's partition chainloadable. Mint can be installed chainloadable so that Grub is entirely contained inside the Mint partition and there is no need to obliterate the universal MBR boot code and consume many sectors after the MBR in a "no man's area" that isn't supposed to be used (which causes conflicts with some other apps too, occasionally). However, for reasons which I do not understand, the installer does not do this in a reliable way.
Note that chainloading Mint's partition using EasyBCD is not reliable either. EasyBCD is only reliable if it uses it's own version of Grub (NeoGrub based on grub4dos, according to Wikipedia) to directly boot Mint and bypass it's Grub.
However, both the "Grub in MBR" and EasyBCD configurations both create a nuiscance dependency of one OS on the other. So the poor user loses the ability to boot anything if either OS is deleted or develops a booting fault. This is not the case with the normal MBR code...at worst the user would have to change the boot flag.
Anyhow, I suppose the bottom line is that Grub should not be installed in place of any MBR code that is being used to boot existing OS'e unless absolutely necessary. So many novice users get caught out by this and have problems, often very time consuming and often they lose valuable data by panicking and reinstalling both Windows and/or Mint. So many that I can't believe how unhelpful and uninformative the Mint installer is (really the Ubuntu installer). The installer needs a redesign and so does Grub so Mint can be reliably chainloaded.
It's all here somewhere: https://help.ubuntu.com/community/Grub2And how do I stop the grub menu appearing altogether, just turn the menu timing to zero? Is there no other way to cause it to boot straight to Mint?
Re: How to safeguard grub in a dual boot?
From EdWh.
Hi Argy-bargy. You can reinstall win7 boot files from install dvd. Insert dvd and let it load files and bring you to a Win7 install menu. At bottom left are 3 choices one of which is repair my computer. Click on it and it will check the hdd and find windows load files are missing and offer to repair. select yes and let it reboot it will rebuild boot files during the reboot. Leave dvd in the drive as it needs it and it iwll take you to desk top and you can shut down and remove dvd, and it will reboot to windows from there on, just used it today. For info it also has diagnostic and repair process to write a new signature in case you ever have that problem, I did and it worked. Hope you can use the info. Im gone. EdWh.
Hi Argy-bargy. You can reinstall win7 boot files from install dvd. Insert dvd and let it load files and bring you to a Win7 install menu. At bottom left are 3 choices one of which is repair my computer. Click on it and it will check the hdd and find windows load files are missing and offer to repair. select yes and let it reboot it will rebuild boot files during the reboot. Leave dvd in the drive as it needs it and it iwll take you to desk top and you can shut down and remove dvd, and it will reboot to windows from there on, just used it today. For info it also has diagnostic and repair process to write a new signature in case you ever have that problem, I did and it worked. Hope you can use the info. Im gone. EdWh.
Re: How to safeguard grub in a dual boot?
Hello
Instead of editing grub.cfg (which will be lost next time GRUB is updated), you can add your entry in /etc/grub.d/40_custom , then type "sudo update-grub".Argy-Bargy wrote:3) manually editing the grub.cfg file to add back the missing Win7 menu selection.