LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Debian (http://www.linuxquestions.org/questions/forumdisplay.php?f=26)
-   -   Grub2 refuses to boot Windows 7 (http://www.linuxquestions.org/questions/showthread.php?t=4175438630)

pwrightfl 11-25-2012 07:57 AM

Grub2 refuses to boot Windows 7
 
Greetings,

For the past week and a half I've been trying to get Grub2 to boot Windows 7 with no luck. Selecting the Win7 menu item causes the machine to reboot and relaunch Grub. Grub is able to find windows 7 and make an entry via os-prober. My internet search has been very inconclusive to a solution and none work, the results are the same. I did come across that there is a possible bug and updating Grub 1.98 to 2.00 may fix the problem, but I'm not sure of the implications changing to a new version and the work-around is the same code (menu entry) generated by grub-update. There also seems to be confusion between grub and grub2, i.e. chainloader and ntldr and answers labeled as a fix don't work on this install. Another fix is to use the Win7 boot manager but I trying not to be dependent MS products.


General info:
Debian 6.0.6
---
fdisk -l

Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 24793 198896641 5 Extended
/dev/sda5 32 24793 198896640 8e Linux LVM

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2 13 5100 40857600 7 HPFS/NTFS
---
grub-install -v
grub-install (GRUB) 1.98+20100804-14+squeeze1

---
Grub menu entry:

menuentry "Windows 7 (loader) (on /dev/sdb1)" {
insmod part_msdos
insmod ntfs
set root='(hd1,msdos1)'
search --no-floppy --fs-uuid --set f2a89d67a89d2b5d
chainloader +1
}

Currently, to get the machine to boot Win7 is to pull the cable on the Linux HD but that really is a bit crude. Any suggestions would be most grateful.

Cheers.

yancek 11-25-2012 11:33 AM

The problem is that windows is on the second drive and needs to be mapped so that windows "thinks" it is on the first drive. Take a look at the first 2 posts at the link below in which a solution is achieved. Reading all the posts will give you some more useful information:

http://forums.justlinux.com/showthre...mapping-drives

malekmustaq 11-25-2012 11:33 AM

Install grub2 again clearing whatever mapping it had:

Code:

grub-install --recheck /dev/sda
And also update-grub

Code:

update-grub
Then try to add a drive mapping entry after the set root command, edit your /boot/grub/grub.cfg that update-grub just created: example:

Code:

menuentry "Windows 7 (loader) (on /dev/sdb1)" {
insmod part_msdos
insmod ntfs
set root='(hd1,msdos1)'
drivemap -s hd0 hd1
search --no-floppy --fs-uuid --set f2a89d67a89d2b5d
chainloader +1
}

See if it works for you.

jheengut 11-25-2012 12:06 PM

maybe it is better to stop using win7 in the first place.

I did it.

did you try lilo??

pwrightfl 11-25-2012 02:06 PM

Thanks for looking.

malekmustaq and yancek, When I first saw mapdrive -s some time last week I thought is was a revelation. Unfortunately is doesn't work. I tried it again to be sure.

---
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sdb1)" {
insmod part_msdos
insmod ntfs
set root='(hd1,msdos1)'
drivemap -s hd0 hd1
search --no-floppy --fs-uuid --set f2a89d67a89d2b5d
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

And trying to follow the logic, I also tried this:

menuentry "Windows 7 (loader) (on /dev/sdb1)" {
insmod part_msdos
insmod ntfs
drivemap -s hd0 hd1
set root='(hd0,msdos1)'

search --no-floppy --fs-uuid --set f2a89d67a89d2b5d
chainloader +1
}

The drives are swapped therefore point to the first partition on the first drive. No go.

Here are the results on the grub-install

# grub-install --recheck /dev/sda
Installation finished. No error reported.
# grub-install --recheck /dev/sdb
Installation finished. No error reported.

And jheengut; My intention is to distance myself from MS and when Steam fully supports LINUX, I'll be that much closer. Also AMD/Radeon say they are supporting video drivers for LINUX but they are not very good.

Cheers

yancek 11-25-2012 02:56 PM

Check to see if the uuid you have is correct for windows sdb1 (f2a89d67a89d2b5d) by running this command: blkid. I'm not sure if case sensitivity is necessary but that would be something to check easily. If the blkid shows uppercase letters, change the uuid entry.

You could try commenting out the "search" line by putting a hash mark (#) at the beginning of the line. I don't believe it is needed to chainload. After making the changes, reboot without running update-grub to see if it works. If it does, copy the entry to the /etc/grub.d/40_custom file, save it and run update-grub again. If it fails, note and messages or errors and post.

You could go to the site below and download/run the bootinfoscript and review its output, a results.txt file to see if that helps. You could also post it here.

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

malekmustaq 11-25-2012 11:34 PM

After editing /boot/grub/grub.cfg do not run either grub-install or update-grub, reboot directly. What is your current "cat"ting of your grub.cfg? Please provide us after failing to boot.

Try swapping the hd0 and hd1 at the drivemap, the chainloader might have confused a bit, try it this way--

Code:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sdb1)" {
insmod part_msdos
insmod ntfs
set root='(hd1,msdos1)'
drivemap -s hd1 hd0
search --no-floppy --fs-uuid --set f2a89d67a89d2b5d
chainloader +1
}

Also, as Yancek suggested meantime comment out '#' the 'search' command as it is not necessary after you have set the root by the drivemap.

HOpe that helps.

Good luck.

pwrightfl 11-30-2012 03:10 PM

Greetings again

So I have tried several of the suggestions, but no joy yet. As to the drivemap command,

drivemap -s hd0 hd1 is equivalent to
map hd0 hd1
map hd1 hd0
, but map is no longer supported.
I tried drivemap -s hd1 hd0 anyway and still no luck.

Other things I have tried with no luck: Both OS on one (first) HD; Both on one drive with the Win7 and 100MB partition removed; Installed Ubuntu instead of Debian. Ubuntu was able to find Win7 but grub still was unable to boot it.

I did come across this in the Grub 2.00 Manual, and several other places:

menuentry "Windows 7" {
insmod ntfs
search --set=root --label WINDOWS_7 --hint hd0,msdos2
ntldr /bootmgr
}

The file ntldr.mod is not available in Grub2 v1.98, but it is in Grub2 v2.00 and Debian experimental packages (grub-pc-bin (2.00-7)). How do you go about in doing just an upgrade to grub? It appears to need grub-pc, but that is only available at v1.98.

Cheers

yancek 12-01-2012 11:55 AM

You could post the output of the bootinfoscript I suggested several days ago.

dhruvats 12-04-2012 05:21 AM

GRUB2 menu entry in my system looks like this:
menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root 0EC08012C07FFDE9
chainloader +1
}
In your GRUB2 entry, "root" keyword is missing as well as "--class windows --class os". Not sure whether these will be really needed.

Also, you could run "os-prober" as administrator in Terminal followed by "update-grub" just to make sure that entries are correctly added.
Post the output of bootinfoscript downloaded from sourceforge.net. This script will generate a Result file in the directory on which it is run.

descendant_command 12-04-2012 05:34 AM

Are you sure the problem is not the windows bootloader?

Can you boot it from another boot manager? (Super-grub-disk or others on ubcd or such).

koka400 02-12-2014 04:50 PM

menuentry "Windows 7 (loader) (on /dev/sdb1)" {

insmod ntfs
set root=(hd1,1)
drivemap -s (hd0) ($root)
chainloader +1

}

Omit this entry: "search --no-floppy --fs-uuid --set=root 0EC08012C07FFDE9" it will load by specifying partition only

set root to your partition: set root=(hd1,1)
then swap drives !!!very important!!!: drivemap -s (hd0) (hd1,1) <-- please note this is your partition not just whole hd1 !!!
chainload +1 or you can use: ntldr/bootmgr

ReaperX7 02-12-2014 09:21 PM

If you're booting from two separate hard drives you technically don't need to manage them with Grub.

There is a hotkey that will allow boot device selection, usually ESC. Just install the bootloader as normal on your Linux drive and when you need to switch just tap ESC at boot and select your drive that way.

It's not what you might be wanting but it's an easy solution.


All times are GMT -5. The time now is 08:03 AM.