If there's still anyone out there who can't hibernate his/her GRUB booted win7 and is still looking for an answer here you go another one;
just to be clear the setup is the following;
Code:
sda:
Win7 bootloader
sda1 ntfs System Reserved (100MB,Win7BootFiles)
sda2 ntfs Windows7Files (the rest on sda, Win7Install)
sdb:
GRUB
sdb1 ntfs Data (the rest on sdb,Data)
sdb2 swap (8GB,SWAP)
sdb3 ext4 (30GB,Linux)
GRUB above means GNU GRUB or GRUB2 that came packed with Ubuntu.
So after running update-grub the notable generated entries are like:
for Windows7:
Code:
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os
{
savedefault
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root D2BA9E65BA9E45BF
chainloader +1
}
and for linux:
Code:
menuentry 'Kubuntu, with Linux 3.2.0-30-generic' --class kubuntu --class gnu-linux --class gnu --class os
{
recordfail
savedefault
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd1,msdos3)'
search --no-floppy --fs-uuid --set=root 7a5eb1c2-19f1-4d1c-a18f-176b3be8ae62
linux /boot/vmlinuz-3.2.0-30-generic root=UUID=7a5eb1c2-19f1-4d1c-a18f-176b3be8ae62 ro
initrd /boot/initrd.img-3.2.0-30-generic
}
We should know that windows-es (Win9X DOS Vista Win7) are assuming themselves being on the first hard-drive, which should not be a problem since our GRUB sets the root to (hd0,msdos1).
After a long time trying out various solutions and menu entries found on the web and constructed by myself, I found that the code above is very very misleading since the search statement overrides the root variable after the "set root" so the indexing of the hard drives isn't necessarily as suggested above the search. I mean of course GRUB believes it to be correct and although it can it doesn't swap the hard drives around helping the installed windows.
(after reading a lot (I mean a lot) about grub and getting familiar with its console function and its various commands (which in my opinion I shouldn't have been forced to do as an end user)) I tried to boot from the console (this is the grub console now) like this:
Code:
set root='(hd0,msdos1)'
ntldr /bootmgr
and I got a "file not found" error (what the hell).
The right one turned out to be:
Code:
set root='(hd1,msdos1)'
ntldr /bootmgr
Of course I still couldn't hibernate because of the twisted hard drive indexing.
So the correct menu entry for me is the following:
Code:
menuentry "Windows 7"
{
drivemap -s (hd0) (hd1)
set root='(hd1,msdos1)'
ntldr /bootmgr
}
the drivemap command virtually swaps the two hard drives given as parameters, but it's properly documented in the GRUB manual.
As this is a known disability of the windows family it really should be integrated in the script generating the menu entries
So the real solution is then:
Finding out the correct hard drive index (the partition index should be correct)
In the GRUB press 'c'.
This will bring up the GRUB console you will get a
It's just like any other console just the commands are a little different.
Now type ls.
This will list the available hard drives and the partitions, further more
in my case if I type ls (hd0,msdos1) it lists the known properties of the (hd0,msdos1) partition which turned out to be my ntfs Data partition.
If you know the proper indices you should turn off the os_probe script which generates the win7 entry from a regular console in ubuntu like this:
sudo chmod -x /etc/grub.d/30_os-prober
after that edit the '40_custom' file in the same place (/etc/grub.d/) and write the following (but of course with the proper hard disk index for this example the hard disk index of the one containing the 'System Reserved' partition will be 9999)
Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows 7" --class windows --class os {
drivemap -s (hd0) (hd9999)
set root='(hd9999,msdos1)'
ntldr /bootmgr
}
then update-grub and done.
Bookmarks