LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Getting Grub2 to boot LMDE and two Windows versions (https://www.linuxquestions.org/questions/linux-general-1/getting-grub2-to-boot-lmde-and-two-windows-versions-4175503472/)

Changes 04-30-2014 01:20 PM

Getting Grub2 to boot LMDE and two Windows versions
 
My netbook's HD is partitioned like this:

sda1 ext4 Linux Mint Debian Edition
sda2 NTFS Win7
sda3 NTFS WinXP
sda4 NTFS user data

In the beginning I only had LMDE and Win7, then I installed XP and as expected it screwed up the bootloader, so I had to restore grub2. However, after I did the computer would only boot XP. Then I ran the Win7 restore from the USB installer and told it to repair the startup process. After a further grub2 restore I can now boot LMDE and Win7, but not WinXP.

I then had a go at modifying grub2 manually, so I went in /etc/grub.d, removed os_prober and added the following to 40_custom:

Code:

menuentry “Windows 7” –class windows –class os {
        set root=(hd0,1)
        insmod ntfs
        chainloader +1
}

menuentry “Windows XP” –class windows –class os {
        set root=(hd0,2)
        insmod ntfs
        chainloader +1
}

I now have the relevant entries in grub2, but no matter what Windows version I choose only 7 ever starts.

How on Earth do I get the selection to work properly and boot LMDE, 7 or XP?

colorpurple21859 04-30-2014 02:02 PM

change windows xp set root entry to (hd0,3)

yancek 04-30-2014 03:29 PM

Windows bootloaders are backware compatible and the problems you report are a direct result of installing xp after windows 7. If you had reversed that process, all you would have had to do is install Mint to the mbr again. It is possible to boot win 7 from xp but the reverse is much easier.

Your partition information and the menuentries you posted conflict. Grub2 counts drives from zero and partitions from one and according to the partition information you posted, win 7 is on sda2 which would give it a menuentry (hd0,2), xp should be (hd0,3) as suggested. If the suggestion above fails, I'd take a look in the windows partitions to see if the correct boot files are on each.

Changes 05-01-2014 09:45 AM

I thought grub2 counted partitions from hd0,0. I fixed the entries to boot 7 from hd0,2 and xp from hd0,3. Now 7 boots as intended, but XP returns a "NTLDR missing" error. I guess the problem now belongs to another message board... thanks for the help.

yancek 05-01-2014 10:09 AM

Quote:

I thought grub2 counted partitions from hd0,0
No, the original Grub Legacy did but that changed with Grub2. If you get an NTLDR is missing message when booting xp, you should be able to mount its partition from Mint and take a look to see if the file is indeed there. If it's not, you might look on the win 7 partition to see if it and the other xp boot files are there. Should be easy to tell as windows 7 bootloader and boot files are different from xp.

ondoho 05-01-2014 10:12 AM

first you should try rebuilding /boot/grub/grub.cfg with one of the grub commands.

sometimes it does not recognize other os'es, although os-prober does, so if that doesn't work, you can run
Code:

/etc/grub.d/30_os-prober > somefile
and extract the appropriate menuentry from there.


All times are GMT -5. The time now is 10:52 AM.