LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Win 7 messed up grub, had to reinstall, want to do dual boot right (https://www.linuxquestions.org/questions/linux-newbie-8/win-7-messed-up-grub-had-to-reinstall-want-to-do-dual-boot-right-4175511029/)

SteveH_66 07-14-2014 04:29 AM

Win 7 messed up grub, had to reinstall, want to do dual boot right
 
Hi all, I was dual booting before, Windows 7 and Linux Mint 12, checking out Linux to see if I like it which I did. Well, I am wanting to install Linux Mint 17, but I want to do it right and not run into the same problem I just went through.

Here's what happened: Somehow Win 7 corrupted my grub boot loader, I know it was Win 7 because I haven't used Mint in a couple of weeks. I am having to reinstall both of them, and it was a fight to get them off of there. Mint put grub somewhere it was impossible to track down, and I had to wipe all the partitions to get rid of it.

In doing my research to try to find out the problem, I read in a couple of places that this was a real problem with Mint, and known, especially with Win 7 thrown into the mix - something about where Mint puts the grub boot loader. I can attest to the fact that it was a tough job getting rid of grub cause I basically could not find it and had to reinstall windows 7 with a disk format.

So here's what I want to do. I want to install a distro that is easy to install and user friendly to new users, I liked the looks of Mint but I'm not stuck on it - if there is another distro that will help me avoid this problem in the future, I would be willing to take a look at it. Would prefer one with different desktops available that I can check out. And as I said earlier, fairly user friendly to new users, as I am still not too experienced with Linux. Also, something that is good on a laptop that is 2 or 3 years old.

And are there any suggestions how to do this in a way so that Win 7 can not mess up everything and I have to go through days of reinstalling? I have to keep dual boot, but I don't want this happening again. I thought different partitions, but I don't know enough about Linux to know if this alone would solve the problem. In the Mint forums they stated that Win 7 had to be installed first to avoid this problem, but obviously Windows found a way to mess it up anyway. If the best way is to uninstall Win 7, install Linux first, and then reinstall Windows then I would be willing to do so - I want to avoid this problem again. I want dual boot and a way to make Windows mind it's manners, if this is possible - somehow I have doubts on that score.

Suggestions needed and most wanted. :) Thank you

NGIB 07-14-2014 05:09 AM

If you are installing Windows and Linux in a dual boot, always install Windows first. Windows does not respect any other OS and always assumes it is "king". Once Windows is installed and running, install the Linux distro of choice. When you get to the installation of the bootloader, usually GRUB, tell it you want to install on the MBR of your Windows drive. It will install GRUB to the MBR, detect all available OSs, and all should go well. I've done this 100s of times and it always works as long as Windows is installed and setup first.

syg00 07-14-2014 06:57 AM

All superstition and folklore.

There is *no* requirement to install Win7 before (any) Linux. Sure Win7 will overlay the MBR and (apparently) delete access to Linux, but this is easily fixed from a liveCD and/or chroot. No need to re-install either system.
Deal with the real issue, not with symptoms.

To the OP, go with Mint17 and be happy - and if Win7 screws up the dual-boot, just ask. If I can find a decent how-to online, I'll post here.

NGIB 07-14-2014 06:59 AM

Quote:

Originally Posted by syg00 (Post 5203579)
All superstition and folklore.

There is *no* requirement to install Win7 before (any) Linux. Sure Win7 will overlay the MBR and (apparently) delete access to Linux, but this is easily fixed from a liveCD and/or chroot. No need to re-install either system.
Deal with the real issue, not with symptoms.

To the OP, go with Mint17 and be happy - and if Win7 screws up the dual-boot, just ask. If I can find a decent how-to online, I'll post here.

Not superstition at all. Windows WILL break Grub which then requires repair. Installing Windows first prevents this from happening. What misinformation did I provide?

Experts would not be asking for simple solutions so the simplest solution is to install Windows first.

yancek 07-14-2014 08:40 AM

syg00 said there is no "requirement" windows be installed first. You didn't say it was "required" but easier and I think his point was that it is a simple matter to reinstall Grub after a windows install. In this particular case, the OP hasn't told us what happened to corrupt the bootloader. Also his comment about where "mint puts the bootloader" means he is not familiar with Grub2 as it is the same as used on Ubuntu and numerous other distributions. A simple command: sudo grub-install /dev/sda might have resovled the issue but not enough information was posted to know.

SteveH_66 07-14-2014 11:55 AM

Additional Information
 
OK, I saw the comment about not posting enough information about how Win7 got messed up and took grub down with it. The truth is, after almost 30 years of using computers I still can't tell you all the ways Windows or the program developers for it can do that - I wish I knew them all, I believe I could make a substantial income in the computer field if I could. My first (that I seriously used) computer was a Commodore Colt with dual 5 1/4 floppies, you ran the programs from one and stored the data on the other. Back then I was even a fair hand at bat file scripting.

Anyway, here is what started happening. In Win7, my most noticeable problem was a loss of my wireless capability. Numerous unistall/reintstalls of the proper wireless driver, latest version from the Acer site for my exact model didn't fix it. It was gone, never to be heard from again. So, I was tied to a network cable, something I don't like on a laptop - I actually use them that way, on my lap, and the fewer cables in the way the better.

So, I decided to take a look at Linux again, being frustrated with Win7. Booted up to Linux, but there was a problem, Linux Mint 12 refused my password. Without full drive encryption for serious security, I just use the same password for Linux and Win7 - since everyone knows if you can get your hands on the computer physically then a live disk gives you everything on the hard disk, as far as I know anyway. I run zone alarm firewall & antivirus plus 4 malware programs so I figure I'm about as safe as you can get from the Internet with Win7. So, when Mint refused my password, I started getting a bad feeling about things.

Now at this time, being able to boot Win7 still and Mint 12 coming up but saying incorrect password, and with Win7 suddenly not wanting to run my wireless, I was getting a bad feeling. But still not too worried yet. Downloaded a live disc of Mint 17 KDE, wanted to test some things out. The live disc booted up fine, and under it my wireless worked fine. A couple weeks before this, I got system crashes under Win7 three nights in a row, and the people at sevenforums were trying to help me diagnose that, but they suddenly stopped happening before I could get log captures to post to that forum.

Then, a couple of days ago I got an error message.
error: that partition does not exist.
grub rescue: _
(the error message to the best of my recollection.)

So now, I couldn't boot into either system. The message indicated to me a corrupted GRUB. So, I started researching that message. I did a google search, tried all the suggested methods for restoring the grub with a live CD. None of them worked, and I was sitting there with a system that would only boot to the Mint Live CD. Checked forums and posts and blogs about restoring the GRUB, tried them all, many were repeats of the processes I had already tried from previous posts. Got tired of that, wiped the system and reinstalled Win7 from the disk.

So, now here I am. I have a fresh install of Windows 7, did that first because I plan to dual boot and I had read in numerous posts if you don't put Windows 7 on first, it will hose the GRUB. I am going to put on the bare minimum of what I consider essential programs in Win7 for me, then I am going to get an Image of Win7 so I can restore it more easily in the future. Then, I am going to set up Linux on the system with dual boot. I am actually thinking about installing a couple of distros so I can look at more than one and see if I like one better than the other.

So basically what I am wanting to do now is install a couple of different Linux distros to take a look at, or possibly 2 versions of the same distro with different desktops and try them a while, then switch out to a different one and see if I can find a distro & desktop version that I like. Keep that, and have the other partition for trying other distros I read about and decide to take a look at.

So basically I am wanting to know how to protect the GRUB from Windows 7 in case of a future reinstall of Windows 7. Once I have an image that shouldn't be too hard to do, and I have a feeling I WILL be having to reinstall Win7 again, or move the image over. It was actually overdue for it, I have had problems with Windows 7 for a while now, for example it was taking 5 minutes to boot up from powered down under Windows 7 - booted in about 30-45 seconds under Mint 12. Defragging the disk and the registry under Windows 7 didn't help, still slow boot and a lot of memory tied up under Windows 7.

So as I said, I am basically wanting to find out how to protect the GRUB from Windows 7 reinstall, and if that isn't possible how to easily reinstall it from a backup or something if it does get messed up again. Because I had a couple of fun days trying to FIND the GRUB (never did) or fix it - never could. Thanks

SteveH_66 07-14-2014 12:10 PM

P.S. Thanks for the posts you folks have already made, I did try the methods outlined in the posts I found from a google search. sudo grub-install /dev/sda2 (which showed as the boot sda in a run of fdsk -l I did) didn't work. As I said, none of the fixes I could find worked. If this happens again in the future, I will come here and see if you good folks can help me through a GRUB2 restore. Hopefully I won't face one that hard again lol. :)

NGIB 07-14-2014 12:20 PM

If you install/reinstall Windows it will overwrite the MBR every time. If you plan on doing lots of installs, I highly suggest making yourself a bootable USB drive containing "rescue" software. I use Parted Magic as it has all the tools I need to fix most problems. The Grub Doctor in Parted Magic would have fixed your issues with just a few clicks...

SteveH_66 07-14-2014 12:48 PM

Thanks NGIB, I was looking around at some other posts and I think on the 'trying different distros' thing I am going to go with a suggestion in another post to install VM and test the different flavors that way, less install uninstall. As for Parted Magic, I used Hiren's boot disk and under the Linux option it brought up a version of linux that had Parted Magic if I remember correctly. I couldn't fix it with that, maybe it was an older version of it, or maybe I just wasn't looking in the right spot. Not very familiar with Hiren's either. I will do a search and read up more on Parted Magic, if there is a rescue disk with Parted Magic on it maybe I can figure out how to use it to restore the GRUB. If not I'll be back! With questions :redface: Thanks

NGIB 07-14-2014 12:52 PM

The last free version of Parted Magic was from August 2013 and it included Grub Doctor - it's still available for download on the web - just Google it.

Grub Doctor is very simple - you choose the partition that contains your linux install and it will reinstall Grub to the MBR and your linux /boot directory...

wizard10000 07-14-2014 01:03 PM

Quote:

Originally Posted by syg00 (Post 5203579)
All superstition and folklore.

There is *no* requirement to install Win7 before (any) Linux. Sure Win7 will overlay the MBR and (apparently) delete access to Linux, but this is easily fixed from a liveCD and/or chroot. No need to re-install either system.
Deal with the real issue, not with symptoms.

To the OP, go with Mint17 and be happy - and if Win7 screws up the dual-boot, just ask. If I can find a decent how-to online, I'll post here.

I don't do dual-boot machines any more but it's always been my preference to let the Windows bootloader chainload grub rather than the other way around; that way you can reinstall either OS without trashing the other one. Here's how I do it -
  • Install Linux. Make sure grub installs on the first Linux partition **instead of the MBR**
  • Install Windows.
  • Start Windows and download and run bootpart (XP) or EasyBCD (Vista and later). It will find your Linux installation, copy the Linux boot sector to the root of the Windows drive and create a boot menu entry to call grub.

It's a little bit more work but it pays off if you ever have to reinstall Windows.

edit: You can also create the Linux boot sector image with dd; but bootpart or EasyBCD is considerably easier.

SteveH_66 07-14-2014 01:16 PM

Thanks Wizard10000. I downloaded EasyBCD and another program called Rescatux, going to try to burn both of those and check them out. That operation doesn't sound too complicated, so I might try that. Can I use EasyBCD to uninstall Windows? I've done a lot of re-installs of Windows when it got corrupted, but I can't ever remember uninstalling it. And if something happens and I have to copy the Win7 image back to the system, EasyBCD will allow me to fix the GRUB again? Thanks

wizard10000 07-14-2014 01:20 PM

Quote:

Originally Posted by SteveH_66 (Post 5203757)
Thanks Wizard10000. I downloaded EasyBCD and another program called Rescatux, going to try to burn both of those and check them out. That operation doesn't sound too complicated, so I might try that. Can I use EasyBCD to uninstall Windows? I've done a lot of re-installs of Windows when it got corrupted, but I can't ever remember uninstalling it. Thanks

If grub was installed on the MBR your Windows reinstall trashed it and you'll need to reinstall grub at least; my suggestion is to install grub on the first Linux partition then boot into Windows and run EasyBCD. It'll find grub, make the proper changes to your Windows partition and you'll be able to select Linux from a Windows boot menu.

edit: To answer the question about Windows breaking grub; if grub is not installed on the MBR Windows can't break it; so yes - once you get things running if you need to reinstall Windows you just run EasyBCD afterward. It finds grub, adds it to the Windows boot menu and away you go :)

Good luck!

jross 07-14-2014 02:10 PM

This is not something I know anything about, but I think this video is similar to Wizard10000's method??:

http://youtu.be/xlTgaWs9BD0

yancek 07-14-2014 03:52 PM

Quote:

Then, a couple of days ago I got an error message.
error: that partition does not exist.
grub rescue: _
That error occurs when a partition has been deleted or there have been changes make to partitions or to uuids. If you had a Mint partition and your deleted it or a Mint boot partition and deleted it or formatted it, that would certainly be expected. Don't know what actually happened.

Quote:

I did try the methods outlined in the posts I found from a google search. sudo grub-install /dev/sda2
That won't help. You installed Grub to the partition not the mbr, it might have worked if you changed sda2 to sda but if you did not have the boot files on the Mint partition, that would not work either.

Quote:

Can I use EasyBCD to uninstall Windows?
No. EasyBCD is software used to boot different systems. You don't uninstall operating systems like windows or Linux, you uninstall applications. If you want to get rid of a system, you select its partition and format it and install something else to the same partition. I'm not sure EasyBCD can boot multiple Linux systems but you can chainload other Linux systems from the Linux bootloader. My understanding of EasyBCD is that is a modified version of Grub built to run on windows (Grub4Dos).

If you have to reinstall windows 7, you will probably have to reinstall EasyBCD as it is generally just downloaded and run from within windows. I seem to recall the possibility of putting it on a CD and making it bootable but it has been years since I used it.

I you are going to be trying multiple systems, something like VirtualBox would probably be the easiest and you should not have to worry about corrupting the bootloader.

wizard10000 07-14-2014 04:31 PM

Quote:

Originally Posted by yancek (Post 5203837)
My understanding of EasyBCD is that is a modified version of Grub built to run on windows (Grub4Dos).

Interesting. I didn't know EasyBCD used grub4dos; bootpart used to just make an image of the Linux boot sector, place the image in the root of c: and allowed you to edit boot.ini

Also, EasyBCD works with Windows XP now also - no need to go chase down bootpart.

+1 to virtualbox if one has the hardware; I run a copy of Win7 Professional in a VM for the once or twice a month I absolutely have to have Windows.

SteveH_66 07-14-2014 04:51 PM

Thanks for all that great information folks! Yanek, I don't know what happened either, but when I was using Hiren's boot disk and everything to look for it, it was weird. The partition management program the boot version of linux on Hiren's was using showed what the file systems were on the different directories, none of them were showing as linux file systems, all 4 partitions were showing as NTFS. I am pretty sure that sda2 was the partition Mint was on, whenever I was booting I am pretty sure GRUB2 was showing sda3 being the partition with Windows 7 on it.

So, like I said, I didn't make any changes myself and particularly no partition changes, and that error message about the partition not existing and grub rescue made me think it was a partition problem as well. And after trying all the steps from the posts I got carefully step by step, making sure there were no spelling errors or what have you, I was thinking something with the partitions since none of the fixes were working. They did seem simple and straightforward, and in all the posts they stated as you did that the procedure to restore the grub were simple, so I figured something serious had happened since the fixes never worked.

But I've gotten a lot of good information from all of you who have posted here in this thread, so hopefully it was just a fluke and if I install carefully this time maybe any grub problems in the future WILL be an easy fix with good install procedures and the resources you have all given me. Many thanks for all the help and information everyone!

P.S. This was an original factory install from Acer that crashed, so it is anyone's guess what kind of crazy partitioning scheme they used and where the boot was set up from, but my new install is from an actual Windows 7 disk so maybe it that will help as well.

yancek 07-14-2014 09:32 PM

Quote:

I didn't know EasyBCD used grub4dos
I just read that somewhere in the last week and can't remember the site. The wikipedia articul below has some info on it, apparently neosmart modified grub4dos which is a modified version of Grub. I do remember seeing 'neogrub' when I used EasyBCD.

http://en.wikipedia.org/wiki/EasyBCD

It's possible you had Mint on an ntfs partition if you used the mint4win software. This is pretty much the same as the Ubuntu wubi (Windows UBuntu installer) which installs Mint inside windows as a program, similar to installing in a virtual machine. I think you would have remembered if you had done that. Wubi is not longer supported so I doubt if mint4win would work on a new release. Also, if you used mint4win I don't believe it would use Grub as wubi would put an entry in the windows bootloader so I expect Mint did the same.

I would suggest that you downoad and run bootinfoscript when you get Linux running. This is a bash script which will give you detailed information about your drives/partitions, boot files, uuid as well as your grub boot menu. Handy information to have at any time. There is a link in the Description box explaining how to use it.

http://sourceforge.net/projects/bootinfoscript/

SteveH_66 07-15-2014 02:55 AM

Hi Yancek, yes I would have remembered that and it wasn't the way I installed. While watching the video linked to by jross in his post, about the alternative method of dual boot, the guy who did the video mentioned that all kinds of Windows things can mess up your dual boot grub even including Windows Updates. I can't say for sure but I believe I saw this and other things listed as possible culprits in that crime when looking for solutions to get my grub back, in various posts, but since I can't remember which posts I might have read that in I can't really say for sure Microsoft was guilty:rolleyes: But it's the only thing I can think of. This alternative method in that video was quite interesting, and I a seriously considering giving it a try.

It does not appear that this would be a total fix for the grub wipeout via windows problem, but using EasyBCD it did appear that it would be a fairly easy fix in the future. My understanding from the video is that it lets Windows boot loader handle choosing which OS to boot, not an idea I like but you know how Microsoft likes to be the top dog in everything, so at least it might make dual boot easier to fix when it messes things up.

If I can find enough of my apps that either have linux versions or that will run under Wine, or after I learn enough about running an OS under VM, I am seriously considering pulling the plug on Windows on my system or putting it on Linux under VM - if that won't bring on a whole new set of problems.

wizard10000 07-15-2014 08:11 AM

Quote:

Originally Posted by yancek (Post 5203965)
I just read that somewhere in the last week and can't remember the site. The wikipedia articul below has some info on it, apparently neosmart modified grub4dos which is a modified version of Grub. I do remember seeing 'neogrub' when I used EasyBCD.

http://en.wikipedia.org/wiki/EasyBCD

Interesting link - I get it now.

EasyBCD works the way I thought it did if grub is installed on the first Linux partition; it copies the boot sector to the root of c: and then BCD calls that image; but if it doesn't find grub or lilo grub4dos is an option but requires a little manual confuration -

Quote:

The traditional chainloading method creates an image of the GRUB/LILO bootsector on the local disk and loads this image during boot-time in order to chainload the second bootloader which should already be configured to boot into Linux or BSD. EasyBCD has profiles for and officially supports the chainloading of GRUB (Legacy), GRUB2, LILO, eLILO, and Wubi (for Ubuntu).

EasyBCD also ships with NeoGrub, a customized build of Grub for Dos, which can be configured by editing C:\NST\menu.lst with the standard Legacy GRUB syntax for directly booting into the needed Linux or BSD partitions, or chainloading another bootloader to load the OS in question.
All in all it's a nice little package. Back in the day in addition to walking barefoot in the snow to and from school (which, BTW was uphill both ways) if you wanted to chainload a Linux bootloader you used dd to make an image of the Linux bootsector, dropped it in the root of c: and then manually edited boot.ini to add Linux as a menu option.

bootpart changed all that, but it's only compatible with XP and below; EasyBCD will do XP through Win8.

cheers - and thanks for the clarification on how EasyBCD works.

yancek 07-15-2014 08:15 AM

If your bootloader gets messed up and you are using EasyBCD to boot both systems, the problem will occur if you are unable to boot windows since EasyBCD resides on the windows partition. So if you are unable to boot windows, you are unable to do any repairs and you may be unable to access either system. You can download an iso which contains EasyBCD but it is no longer free, $19.95USD.

The video link is about 35 minutes longer than it needed to be. It's basically "How to use EasyBCD to boot Linux". The only reason I can see to use it is if you are totally unfamiliar with Linux but familiar with windows and/or you have a new OEM install under warranty. Some manufacturers will not repair a computer which has software that was not original with the install, such as the Grub bootloader. Other manufacturers will. So basically, EasyBCD is a modified version of a modified version of Grub. The advantage with the original Grub is that it is on any installation medium and repairing Grub can often be done with a single, simple command.

jross 07-15-2014 08:30 PM

Quote:

Originally Posted by yancek (Post 5204172)
If your bootloader gets messed up and you are using EasyBCD to boot both systems, the problem will occur if you are unable to boot windows since EasyBCD resides on the windows partition. So if you are unable to boot windows, you are unable to do any repairs and you may be unable to access either system. You can download an iso which contains EasyBCD but it is no longer free, $19.95USD.

That's not the way I interpreted the explanation in the video. He said the MBR seeks out the first device, so if the windows bootloader or linux goes down, it will seek out the other one. Also, I don't understand what you mean by "EasyBCD resides on the windows partition". Again, my interpretation was he said all he did was use Easy BCD to add an entry to the windows bootloader. So, to me he just used it as an "editing tool" and it doesn't "reside" anywhere, it was used and that was the end of its role.

Quote:

So basically, EasyBCD is a modified version of a modified version of Grub. The advantage with the original Grub is that it is on any installation medium and repairing Grub can often be done with a single, simple command.
Again, I am not following your logic compared to the video's explanation. The set up just has the windows bootloader having a entry which allows it to point to Grub (which is located on the linux root partition). When you click the linux option, the Grub loads as it would in a traditional set up, which would still be available for repair.

That is the way I understood it anyway.

yancek 07-15-2014 10:52 PM

The MBR doesn't seek out the first device. The BIOS settings determine which device and that is usually the mbr on the first device but it can be changed to a second or third or other device. The mbr is at a specific location on any hard drive. It can contain a very tiny bit of code, 512bytes and it doesn't do much more than point to the partition which contains the boot files. This happens whether it is the Grub or windows bootloader. Almost all the necessary files to boot a Linux or windows system are on the system or boot partition, if a boot partition exists.

Quote:

Also, I don't understand what you mean by "EasyBCD resides on the windows partition"
EasyBCD is a software application. You go to the neosmart site from windows, download it to your windows partition and that is where it is and you can use it from there to modify boot files. After editing, it isn't used. My point is that if the bootloader gets corrupted and you are unable to boot your windows system, you can then not access EasyBCD to try to repair because it is on the windows partition. As I said above, they used to allow a download to put it on a CD to boot from which would be more useful but now they charge $19.95USD.

If you have used EasyBCD you will see that it uses what they call 'neogrub' and that is a modification of a windows software 'grub4dos' which is a modification of the actual Grub.

Quote:

When you click the linux option, the Grub loads as it would in a traditional set up, which would still be available for repair.
True. The same could be done in the reverse, using Grub on the mbr and booting to windows. The problem as I stated above is what if you can't boot either. With Grub, you have your installation CD/DVD with Grub on to repair the bootloader. If you can't boot either using EasyBCD for any reason you can't use it because it is on the windows partition and inaccessible.

The tutorial would more accurately have been titled "How to use EasyBCD to boot windows and Linux" and he could have left off the first 30+ minutes of the tutorial.


All times are GMT -5. The time now is 11:27 AM.