LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-26-2005, 09:16 PM   #1
BillyGalbreath
Member
 
Registered: Nov 2005
Location: Houston Texas
Distribution: Debian Sid
Posts: 379

Rep: Reputation: 31
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!

Last edited by XavierP; 12-27-2005 at 08:04 AM.
 
Old 12-26-2005, 11:52 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 12-27-2005, 12:40 AM   #3
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
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
 
Old 12-27-2005, 08:06 AM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
BillyGalbreath - I have added the code tags to your code so it doesn't break the tables.
 
Old 12-27-2005, 08:10 AM   #5
BillyGalbreath
Member
 
Registered: Nov 2005
Location: Houston Texas
Distribution: Debian Sid
Posts: 379

Original Poster
Rep: Reputation: 31
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.
 
Old 12-27-2005, 09:08 AM   #6
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
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.
 
Old 12-27-2005, 11:18 AM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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!!!

Last edited by saikee; 12-27-2005 at 11:22 AM.
 
Old 12-27-2005, 02:39 PM   #8
BinJajer
Member
 
Registered: Sep 2005
Location: Warsaw, Poland
Distribution: Slackware 10.2, Caldera OpenLinux 3.1, Corel Linux (Thanks xhi!), Debian GNU/HURD etc...
Posts: 296
Blog Entries: 1

Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need grub menu.lst example pk108 Mandriva 4 12-11-2004 06:45 PM
grub.conf vs. menu.lst netstv Linux - General 3 11-24-2004 06:19 PM
Grub, can someone posts their Menu.lst please webwolf70 cAos 6 10-21-2004 12:37 AM
grub.conf vs menu.lst linmix Linux - Software 2 08-26-2004 03:17 PM
grub.conf is menu.lst??? zombyLINUX Linux - General 4 03-31-2004 08:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration