Debian grub2 update removed Windows boot option

4

1

Since I updated grub to grub 2 I no longer get the option to boot to Windows (which is unfortunately sometimes necessary for proprietary MSIE browser plugins I need to use for work).

Relevant /boot/grub/menu.lst portion:

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title           Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title           Windows NT/2000/XP
root            (hd0,0)
savedefault
makeactive
chainloader     +1

This however does not appear anymore. I do have some entries in /boot/grub/grub.cfg with entries like these:

menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
        insmod part_msdos
        insmod ext2
        set root='(hd1,msdos1)'
        search --no-floppy --fs-uuid --set e638c434-4884-412f-a141-2c194f881fae
        echo    'Loading Linux 2.6.32-5-amd64 ...'
        linux   /boot/vmlinuz-2.6.32-5-amd64 root=UUID=e638c434-4884-412f-a141-2c194f881fae ro  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-2.6.32-5-amd64
}

Do I have to alter that file? If so, what is the correct syntax for a Windows boot? If not, what could be the problem?

Wrikken

Posted 2010-09-28T14:10:32.543

Reputation: 985

Answers

4

This is based on for Ubuntu but it should be valid for Debian's grub2-package too:

/boot/grub/grub.cfg is overwritten each time you run /usr/sbin/update-grub2 or when it's called after a kernel update. grub2 should have auto-detected the windows installation via /etc/grub.d/30_os-prober and added it to the boot menu. Howewer custom entries should be made in /etc/grub.d/40_custom

Update:

You could try to add the Windows Loader manually by adding the following to /etc/grub.d/40_custom:

menuentry "Windows on /dev/hda1" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set YOURUUID
chainloader +1
}

"YOURUUID" is the UUID of your Windows partition. You can get it by doing a ls -l /dev/disk/by-uuid/ | grep hda1. After editing the file do a "sudo update-grub2" to generate a new grub.cfg.

It depends on os-prober, which may not be installed, in which case do a:

sudo apt-get install os-prober

... and run sudo update-grub2 again.

user16115

Posted 2010-09-28T14:10:32.543

Reputation:

update-grub2 indeed creates a new configutaion file, /etc/grub.d/30_os-orober is there, but elas, no Windows entry as of yet, so it seems it cannot detect it for some reason. Could it be a hd is blacklisted somewhere? (/grasping at straws). – Wrikken – 2010-09-28T15:23:13.463

I don't know if there cold be a blacklisted hd. I'm still not really experienced with grub2. What output do you get from "sudo os-prober"? – None – 2010-09-28T16:04:02.113

Aha, that was it, although I had a /etc/grub.d/30_os-prober, it depended on the (quite obviously named) os-prober executable which wasn't on the system (and for some reason grub fails to provide even a simple error report about that). A simple install of that package and rerunning update-grub2 did the trick, it's in grub.cfg now, my thanks! – Wrikken – 2010-09-28T16:55:13.720

4

Wrikken's solution also worked for me. I'm regurgitating it in easy to follow directions.

Step 1

sudo apt-get install os-prober

This can be tested with:

sudo os-prober

Which, for me, gives the output:

/dev/sda1:Microsoft Windows XP Professional:Windows:chain

Step 2

sudo update-grub2

John

Posted 2010-09-28T14:10:32.543

Reputation: 41

1Ack., see my comment @ the 28th of september, this was indeed what solved it. – Wrikken – 2011-01-03T18:25:54.177

Maybe you can copy and paste my answer as your own (and then I can remove mine)? I believe it is better if the solution is part of the answer instead of in the comments. – John – 2011-01-04T14:52:20.517