grub boot issue

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,451
i'd search this forum, but im on my phone.

I have a dual boot pc with xp and linux. Problem was i didn't have the root password to linux, so i decided to redo an ubuntu install. Problem is that the pc now boots straight into ubuntu (without the decency of giving me a grub menu), and i can't get into xp.

What should i add to the grub.cfg to get windows running again? I've noticed i need to specify the partition's signature; which command do i use to retrieve this information?
 

psheldon

Well-Known Member
Joined
Jan 24, 2006
Messages
364
title=windows
rootnoverify (hd2,0)
makeactive
chainloader +1

That HD2.0 is where XP is on your system
 

MyWorld

Executive Member
Joined
Mar 24, 2004
Messages
5,001
title=windows
rootnoverify (hd2,0)
makeactive
chainloader +1

That HD2.0 is where XP is on your system
Ubuntu uses Grub2 and do not follow this layout/code any more.

What should i add to the grub.cfg to get windows running again?
Code:
cat /boot/grub/grub.cfg 
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

So according to the documentation it is either:
update-grub
or
grub-mkconfig

That said, I hate Grub so do not have a full grasp of it.
 
Last edited:

dabbler

Expert Member
Joined
Apr 15, 2006
Messages
3,512
The latest Partition Magic CD has an extended menu giving you Grub AND Grub2 recovery tools.

Sent from my GT-I9000 using MyBroadband Android App
 

MyWorld

Executive Member
Joined
Mar 24, 2004
Messages
5,001
That is to restore/reinstall Grub, grub boot loader, XP boot loader and Win7 boot loader... nothing about adding another OS to the Grub menu?
o_O
 

ocky

Well-Known Member
Joined
Apr 6, 2007
Messages
158
Make a custom entry for Windows..

Step 3: Create a boot file for Windows XP/Vista/7

Boot into your Linux system by selecting your kernel (if there are multiple) from your GRUB2 menu and see if it boots fine. Upon booting into Linux do the following:
# nano /etc/grub.d/11_Windows (this will essentially create a new file)

and add the following lines:

#! /bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows XP" {
set root=(hd0,1)
chainloader +1
}
EOF

chmod a+x /etc/grub.d/11_Windows

Now save the file (11_Windows) and give the following command:

# update-grub2

Reboot

Note: In earlier version of GRUB, if your Windows was installed on First partition then you need to give root=(hd0,0), since that’s how GRUB use to number the partitions. However from this new version onwards, you need to give root=(hd0,1) if your Windows is installed on first partition of the hard drive.

Source... http://linux.koolsolutions.com/2008...ual-boot-does-not-boot-from-grub2-or-grub-pc/
 

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,451
Thanks guys, going to test these over the weekend on virtualbox.

I take it the file should look exactly like this (but excluding the first #!)?
#! /bin/sh -e
echo "Adding Windows" >&2
cat << EOF
menuentry "Windows XP" {
set root=(hd0,1)
chainloader +1
}
EOF

chmod a+x /etc/grub.d/11_Windows
 

ocky

Well-Known Member
Joined
Apr 6, 2007
Messages
158
Thanks guys, going to test these over the weekend on virtualbox.

I take it the file should look exactly like this (but excluding the first #!)?

No, it should look exactly like shown - nothing excluded. Just make sure you have the (hdx,x) correct. (hd0,1) is correct provided Windows is installed on the first hard drive, first partition.

You could alternatively add the entry to the existing 40_custom file; then the Windows entry will be at the bottom of your Grub2 menu. (Note the addition of exec tail -n +3 $0 for the 40_custom file. )

#!/bin/sh
echo "Adding Windows" >&2
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.


cat << EOF
menuentry "Windows XP" {
set root=(hd0,1)
chainloader +1
}
EOF


I no longer use Windows so am unable to experiment, but hope all works out for you.
 
Last edited:
Top