7

I had Windows 7 installed on my system, then I installed Debian testing with grub2 as its boot manager. Initially I couldn't see windows entry in grub at all, so I ran:

aptitude install os-prober kcpuload 
update-grub

Now I can see the entry, but when I select it I get only Win7 system restore, instead of the the real thing. Any ides how to make it work?

EDIT: I tried the suggested approach to add a new file to /etc/grub.d, which generated an entry in grub.cfg, but it does not appear in the grub menu on boot :(

I have this:

grzes:/home/ga# cat /etc/grub.d/11_Windows
#! /bin/sh -e
echo Adding Windows >&2
cat << EOF
menuentry “Windows 7″ {
        set root=(hd0,2)
        chainloader +1
}

And I have the following grub.cfg file:

grzes:/home/ga# cat /boot/grub/grub.cfg
#                                      
# DO NOT EDIT THIS FILE                
#                                      
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub                    
#                                                                         

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then    
  load_env                         
fi                                 
set default="0"                    
if [ ${prev_saved_entry} ]; then   
  set saved_entry=${prev_saved_entry}
  save_env saved_entry               
  set prev_saved_entry=              
  save_env prev_saved_entry          
  set boot_once=true                 
fi                                   

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}     
    save_env saved_entry      
  fi                          
}                             
insmod ext2                   
set root=(hd0,3)              
search --no-floppy --fs-uuid --set 6ce3ff31-0ef7-41df-a6f5-b6b886db3a94
if loadfont /usr/share/grub/unicode.pf2 ; then                         
  set gfxmode=640x480                                                  
  insmod gfxterm                                                       
  insmod vbe                                                           
  if terminal_output gfxterm ; then true ; else                        
    # For backward compatibility with versions of terminal.mod that don't                                                                                    
    # understand terminal_output                                                                                                                             
    terminal gfxterm                                                                                                                                         
  fi                                                                                                                                                         
fi                                                                                                                                                           
set locale_dir=/boot/grub/locale                                                                                                                             
set lang=en                                                                                                                                                  
insmod gettext                                                                                                                                               
set timeout=5                                                                                                                                                
### END /etc/grub.d/00_header ###  

2 Answers 2

6

First, you'll need to check the config. Its in theee... thee... /etc/grub.d/ ? /etc/grub/?.. somewhere there. Config file names look like this: 00xy, 10linux, 20other ... these are just examples, but the real thing is almost the same. Check them, where is the windows one. Back it up (copy it somewhere). You'll need something like this into the file:

menuentry "Windows" {
set root=(hd0,3)
chainloader +1
}

If you haven't got any config file like this, just create one. Grub2's config reading is easy-to-understand. It goes incrementally. Like: 00* , 10*, 20*, etc. So your new file should be named 95-windowsfix if you want it to be the last entry, or give it a smaller number (to make it the first entry) than Linux configs have if you want it to be the first.)

in the 'other' config file. Modify the set root value of course. Determine the hdd by typing: sudo fdisk -l . For example, /dev/sda1 is (hd0,0) if its on the second HDD: /dev/sdb1 >> (hd1,0) ..and so on. You can understand the syntax from this I guess. After you made the modifications, do an update-grub and you can try to boot it.

I'm aware that this looks like a huge mess. Sorry for that. I don't have any Ubuntu machine near to me with Grub2 so thats why I wrote this much "i guess". If you won't be able to get it work, just ask.

6
  • Hi, I have tried your solution, but it didn't work :( Please see the post edit for details.
    – Grzenio
    Commented Feb 1, 2010 at 8:39
  • WHat does it say when you try to boot it? Remember, you have to give the BOOT partition of the Window 7. It creates 2 partition by default. 1 100mb for boot. THATS the one you want.
    – Apache
    Commented Feb 1, 2010 at 12:11
  • Ahhh, I gave it the wrong partition. Let me try with the 100mb partition. The weird thing though is that I can't see this option at all :(
    – Grzenio
    Commented Feb 1, 2010 at 21:52
  • What option? Its the (hd0,0) part.
    – Apache
    Commented Feb 2, 2010 at 13:54
  • 2
    grub2 numbers its partitions starting at 1. there is no "(hd0,0)", that's a grub1 spec. in grub2 it's "(hd0,1)". Commented Feb 10, 2010 at 5:45
2

Try this:

grub-mkconfig -o /boot/grub/grub.cfg
1
  • 3
    And then? What will happen when one "tries this"??
    – phresnel
    Commented Mar 29, 2013 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .