repair grub after win7 reinstall

Old threads created long before the LMDE forum restructuring

repair grub after win7 reinstall

Postby qbicdesign on Sun Nov 21, 2010 9:04 pm

I've been running a triple boot for a while with the following order of installs:

first installed winxp
second installed win7 64bit
third installed LMDE

LMDE has since become my preferred OS, but I need to keep some apps from Windows - yes I know i could run them in virtualbox, but they're graphics programs requiring too much video and system resources for that.
After a while struggling with Win7 64bit driver issues, i decided to scrap both Win7 64bit, and XP and install only Win7 32 bit, whilst keeping LMDE
The install went fine, and as you'd expect, I cannot boot into LMDE after without reconfiguring grub, which is turning out to be more complicated than I would like.

Fristly, I noticed that from the LMDE boot dvd there is no rescue option... is that normal?
Right now I booted LMDE using Supergrub2 boot disk, but I'd like to get the boot menu properly fixed.
I have already ran update-grub from terminal, and grub detected and re-added Windows 7 to the list

Can I now simply remove the boot flag from the Win7 partition and add it to my LMDE partition instead? Or are there more steps I need to take?

Win7 is installed on sda2, but the mbr seems to be in sda1 (a 100mb partition created during win7 install)
LMDE is installed on sda5

Does anyone have any advice how to complete this grub repair?
qbicdesign
Level 3
Level 3
 
Posts: 148
Joined: Thu Oct 16, 2008 10:51 am
Location: Tallinn, Estonia

Linux Mint is funded by ads and donations.
 

Re: repair grub after win7 reinstall

Postby hemimaniac on Sun Nov 21, 2010 9:46 pm

I see this more and more, here is your fix

only consideration you need to take that the article doesnt explain very well is grub must be installed to the first HDD/Partition the bios sees

so if sda1 is xp
sda2 is win7
sda3 or sdb1 etc etc is linux but the bios sees the sda disk first, that is where grub gets installed to as per the article instructions
"Linux allows for one thing above all else - 'A user can truly be themselves!'"
Image
User avatar
hemimaniac
Level 5
Level 5
 
Posts: 508
Joined: Thu Feb 04, 2010 1:26 pm
Location: London ON

Re: repair grub after win7 reinstall

Postby cwsnyder on Mon Nov 22, 2010 8:52 am

I see a potential problem not covered by the article, responses, or responses here. Windows Vista and Win7 both install a separate partition boot loader partition and competitor to GRUB/LILO. When Windows is installed first, this Vista boot partition is installed as the first partition (or modifies WinXP), and I have known Windows Update to re-install the Vista boot. GRUB/GRUB2 wants to take over the MBR and part of that partition and gets clobbered regularly. Windows XP has clobbered GRUB when re-installed, but not on updates.

The only stable configuration which I personally have maintained were with separate hard disks, selecting the system I want to boot by my BIOS boot selector. I have my /dev/sda drive set up for Windows with /dev/sda1 as the Vista boot partition and Windows XP, /dev/sda2 is Windows 7. Windows XP was installed first, Windows 7 was installed as an upgrade afterward. My Windows XP OEM modified install disk will only install and run as the first partition (PC Angels mod). /dev/sdb is my Linux partition with LMDE as /dev/sdb1, /dev/sdb3 is the W95 Extended (LBA)partition, /dev/sdb5 Debian 5 (Lenny) /, /dev/sdb6 is my Swap partition, /dev/sdb7 is /home for Debian. This is as seen by LMDE after booting from /dev/sdb.

You could also use the Vista boot loader to get to your Linux options after (manually) modifying the Vista boot loader which Win7 inherited with the proper Windows utility so that the Registry and flags get reset properly. Windows does not automatically detect Linux partitions/installations.

Note that with this configuration Windows XP is not recognized by GRUB2 at all! Win7 does show up and will run from GRUB. Before I installed Win7, XP only caused me to have to fix GRUB Legacy when I had to re-install Windows for whatever reason, and Windows XP would show up for GRUB Legacy. WinXP is a boot option within the Vista boot loader, as 'older version of Windows'. I never had GRUB2 installed without Win7.

With this configuration, I have re-installed Windows XP and Win7 as needed (of course you know you will have to re-install Windows occasionally if you use it?) and upgraded/installed Linux as needed for changing releases without corrupting the boot process for either Windows or GRUB2 for about 18 months now.

I did have a problem that LMDE did not properly recognize a separate /home partition on /dev/sdb2, which is why my LMDE is on a single partition, but I was able to combine / and /home without disturbing my Debian install. I figured if LMDE was a rolling release there was not the urgency of using a separate /home partition that there had been using Ubuntu and upgrading every 6 months.
LMDE Mate 64-bit, LM16 Mate 64-bit
Debian Xfce 64-bit, Xubuntu 13.10 64-bit, Xubuntu Trusty Tahr 64-bit, Antergos Xfce 64-bit, PCLinuxOS LXDE 64-bit
cwsnyder
Level 6
Level 6
 
Posts: 1039
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: repair grub after win7 reinstall

Postby qbicdesign on Mon Nov 22, 2010 10:10 am

Well I'm glad to say the suggested solution worked perfectly.

The potential problem mentioned is a very real concern, but for me it was OK since Windows 7 was installed to the same physical drive as Linux. both are on sda.
Linux was able to successfully write grub to the boot sector as needed.
I guess there may be issues if windows is installed to a different physical drive than Linux.
qbicdesign
Level 3
Level 3
 
Posts: 148
Joined: Thu Oct 16, 2008 10:51 am
Location: Tallinn, Estonia


Return to Archive

Who is online

Users browsing this forum: No registered users and 2 guests