LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub will not let me add Windows XP to menu.lst (https://www.linuxquestions.org/questions/linux-general-1/grub-will-not-let-me-add-windows-xp-to-menu-lst-396732/)

BillyGalbreath 12-26-2005 09:16 PM

Grub will not let me add Windows XP to menu.lst
 
I have two hard drives. The primary has 4 liunx partitions (3 ext3, 1 swap), the secondary has 1 ntfs. Here is my layout:

Code:

Disk /dev/hda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1              1        3188    25607578+  83  Linux
/dev/hda2            3189        3310      979965  82  Linux swap / Solaris
/dev/hda3            3311        6349    24410767+  83  Linux
/dev/hda4            6350      24321  144360090  83  Linux

Disk /dev/hdb: 8455 MB, 8455200768 bytes
255 heads, 63 sectors/track, 1027 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdb1  *          1        1026    8241313+  7  HPFS/NTFS


I try to add my windows xp to my grub but it wont take. When i run update-grub it resets me menu.lst file and removes my windows stuff i put in.

I am not totally dumb to this, I know my way around, and I can still boot into windows on boot by pressing "C" at grub to get the grub command line. I then type this stuff in:
Code:

grub> rootnoverify (hd1,0)
grub> map (hd1) (hd0)
grub> map (hd0) (hd1)
grub> chainloader +1
grub> makeactive
grub> boot

And then my windows XP boots up like normal. But when I add this crap to my menu.lst file and run update-grub, the stuff gets erased and it never hits my grub list on boot.

Here is my menu.lst file of what it wants to be:

Code:

###############################################################

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
default        0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        5

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title        Windows 95/98/NT/2000
# root          (hd0,0)
# makeactive
# chainloader  +1
#
# title        Linux
# root          (hd0,1)
# kernel        /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specifiv kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
# kopt=root=/dev/hda3 ro vga=792

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,2)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## ## End Default Options ##

title          Debian GNU/Linux, kernel 2.6.8-2-386
root            (hd0,2)
kernel          /boot/vmlinuz-2.6.8-2-386 root=/dev/hda3 ro vga=792
initrd          /boot/initrd.img-2.6.8-2-386
savedefault
boot

title          Debian GNU/Linux, kernel 2.6.8-2-386 (recovery mode)
root            (hd0,2)
kernel          /boot/vmlinuz-2.6.8-2-386 root=/dev/hda3 ro vga=792 single
initrd          /boot/initrd.img-2.6.8-2-386
savedefault
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

###############################################################

Now I add my windows stuff before my very last line like so:


Code:

## ## End Default Options ##
 
 title          Debian GNU/Linux, kernel 2.6.8-2-386
 root            (hd0,2)
 kernel          /boot/vmlinuz-2.6.8-2-386 root=/dev/hda3 ro vga=792
 initrd          /boot/initrd.img-2.6.8-2-386
 savedefault
 boot
 
 title          Debian GNU/Linux, kernel 2.6.8-2-386 (recovery mode)
 root            (hd0,2)
 kernel          /boot/vmlinuz-2.6.8-2-386 root=/dev/hda3 ro vga=792 single
 initrd          /boot/initrd.img-2.6.8-2-386
 savedefault
 boot

title          Windows XP
rootnoverify          (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1)
chainloader +1
makeactive
boot
 
 ### END DEBIAN AUTOMAGIC KERNELS LIST

Then When I run update-grub... it goes back to the normal menu.lst like i never changed it...

I am so lost... I'd like to be able to boot into windows without having to type in the commands everytime.. Anyone know whats wrong??

I run Debian 3.1r0a Sarge.

Thanks!

Nylex 12-26-2005 11:52 PM

Did you try just adding the entry to the file and not running update-grub? From this, it looks like it just generates the file with entries according to what images are in your /boot.

TruongAn 12-27-2005 12:40 AM

For what did you run update-grub
I don't have that command on my FC box
And I don't need to do anything after edit the menu.lst file

XavierP 12-27-2005 08:06 AM

BillyGalbreath - I have added the code tags to your code so it doesn't break the tables.

BillyGalbreath 12-27-2005 08:10 AM

I'll try this tonight - I was told to always run update-grub after I edit the menu.lst file...

From your link, Nylex:

"After update-grub has been run for the first time, the user is required to edit the generated menu.lst. The user must set the two options update-grub uses. Then re-run the update-grub script to update the menu.lst file using the default's that have been set."

And this is what I was taught also. You make your edits to the menu.lst file, then you have to pass the changes to the kernel by running update-grub.

TruongAn 12-27-2005 09:08 AM

Quote:

And this is what I was taught also. You make your edits to the menu.lst file, then you have to pass the changes to the kernel by running update-grub.
I saw no line tell that you have to pass the changes to the kernel.
The options you add in the menu.lst file will be given to the kernel while grub load your linux.
Kernel take these options and boot up the way you want.

update-grub is used to make the initial menu.lst file.
It will find your kernel and creat an entry for that kernel.
I do nothing but edit your menu.lst file.
So if you have manually editted your menu.lst file, there were no need to run it.

In FC4, I don't have the command but grub still work properly.
I think you have know so much about grub.
And that make you confuse.

saikee 12-27-2005 11:18 AM

Only Lilo need an update after its /etc/lilo.conf has been edited, because checks the correctness of every entry.

Grub never needs an update. I use it to boot 100+ systems. I have Grub booting 3 Dos and 3 Windows there.

I would be in a very shitty situation to learn that I need to run update-grub now!

I got the feeling if you stop this "update-grub" thing once it may just work!!!

BinJajer 12-27-2005 02:39 PM

update-grub is a deprecated command. I do not suggest using it.
Just add the position to your menu.lst

It should look like this:

title Windows XP
rootnoverify (hd1,0)
makeactive
chainloader +1

That is all.


All times are GMT -5. The time now is 05:54 PM.