LinuxQuestions.org
Visit Jeremy's Blog.
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 03-01-2006, 07:34 AM   #1
MurX
Member
 
Registered: Oct 2005
Location: London
Distribution: elive e17
Posts: 152

Rep: Reputation: 30
How do I install GRUB without having to install a new distro?


I have 3 distros on my HD and each time I have to reinstall one of them I have re-install Grub to the MBR.

I want to install another disto and to leave Grub on the MBR as it is.

Is there some way of modifying the MBR without having to do a whole re-install each time?


I know I can edit

/boot/grub/menu.lst file

but if I install a disto and tell it NOT to install grub I find that I can not boot into the new distro.
 
Old 03-01-2006, 07:39 AM   #2
rfokker
LQ Newbie
 
Registered: Feb 2006
Posts: 3

Rep: Reputation: 0
With my Grub i can live edit the list of items so i can specify a new item with its partition where to boot. This should be a solution to not reinstall, but it is very manual.
 
Old 03-01-2006, 07:55 AM   #3
kevkim55
Member
 
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
Quote:
but if I install a disto and tell it NOT to install grub I find that I can not boot into the new distro.
To the contrary, you can choose not install grub while (re)installing a (new) distro and simply edit the file menu.lst to include for the new installtion.
Supposing you've 4 distros - distro1, distro2, distro3 and distro4 with distro1 having installed GRUB to the MBR, edit the menu.lst file and include the lines for the other 3 distros and you should be able to boot them up. It is vital that you specify the correct partition, kernel name and initrd image for the all the other 3 distros.
 
Old 03-01-2006, 11:50 AM   #4
MurX
Member
 
Registered: Oct 2005
Location: London
Distribution: elive e17
Posts: 152

Original Poster
Rep: Reputation: 30
"It is vital that you specify the correct partition, kernel name and initrd image for the all the other 3 distros."

This is where I noramlly get stuck. I know the drives etc but the kernel name and initrd image I can never find, even if I boot up into one of the other distros.

I have 3 distros at the moment and they all work fine, I want to install another but if I bugger up grub then I have to go back and re-install one of the other 3 to fix grub.


Perhaps I should ask, how can I see the file names of the new distro so that I can modify grub appropriatly?
 
Old 03-04-2006, 12:37 AM   #5
kevkim55
Member
 
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
You've said you're able to boot into each of the 3 distros. Boot into each of the distros and do the following.
Look for the file /boot/grub/menu.lst or /boot/grub/grub.conf If you find one, open it using your favorite editor and look for the first entry which normally would be for the distro you'be booted in. Note down the entries like kernel, initrd etc. Repeat the procedure for the distros as well. Now, you have the entries for all the distros you've installed. Now boot into the distro which you installed last as it is this distro that'd last put GRUB in MBR. Edit the menu.lst or grub.cof whichever is installed and add the entries for the distros you've just noted or copied. Now you should be set to go. Whenever you boot, GRUB lists the titles of all the entries in menu.lst and all you'll have to do would be select the title for the distro you'd wanna boot into and GRUB will do just that.
Another method to achieve the same and which, will also help you in case you want to install another distro as you've already said you'd want - Boot into each of the distros and change to the /boot directory. Do a "ls -l" and you'll see the kernels and initrds installed. Normally a kernel file would start with "vmlinuz" viz. vmlinuz-2.6.13-15-default in SuSE 10.0 and initrd file would start with "initrd" viz. initrd-2.6.13-15-default.img in SuSE 10.0. An easy way to find out which kernel and initrd are default would be to check the symlinks vmlinuz and initrd. These two symlinks should point at the default kernel and initrd respectively. Note down the full name of kernel and initrd. Read on...
Now, you've the names of the kernels and initrds of all the distros. Edit the menu.lst of the distro which you last installed and which has last installed GRUB on MBR and add the lines for the other distros. An example :

title SuSE Linux 10.0
root (hd0,1)
kernel /vmlinuz-2.6.13-15-defailt root=/dev/hda3 splash=silent
initrd /initrd-2.6.13-15-default.img
boot

Note that the keywords title, kernel and initrd should all be lowercase and the kernel/initrd image names are case sensitive too. Replace /dev/hda3 with the drive and partition where the root partition of the corresponding distro is. Replace (hd0,1) with the drive and partition number where the boot partition of the corresponding distro.

If you install another distro choose not to insall GRUB and the repeat the procedure above i.e. note down the kernel name and initrd name and add an entry to the default GRUB menu.lst file. Of-course you can choose to install GRUB and then you'll have to edit the menu.lst of the newly installed system and add the entries for the the other distro. Either way it'd work.

The goal is to tell GRUB where the boot partition is and the names of both kernel and/or initrd image and specify the kernel parameters on the kernel line (root=/dev/??? would be the most important though) and finally ask GRUB to boot into it. The boot and root partitions could be on any disk and any partition, GRUB will be able to boot into it.

Hope this helps you. Shout back if it didn't.
 
Old 03-04-2006, 01:30 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
On the contrary - when you install each new distro, you certainly *do* want to install a bootloader. Just make sure it is installed to a partition rather than the MBR.
That way the menu.lst (or lilo.conf) get created, and you can simply copy/paste this info as above. Too hard to figure out otherwise, unless you know what you're doing.
 
Old 03-04-2006, 03:27 AM   #7
MurX
Member
 
Registered: Oct 2005
Location: London
Distribution: elive e17
Posts: 152

Original Poster
Rep: Reputation: 30
thanks for that people. I have manged to fix grub and get it to do what I want it to do.

my thanks again.
 
  


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
fc3 install doesnt install grub properly onto sata drive sabo Linux - Newbie 4 02-03-2007 04:04 PM
Grub 0.97 issues on slackware - grub-install is very slow, & updating menu.lst fails dieyouspammer Linux - Software 1 02-27-2006 01:06 PM
newbie: looking for easy to install distro that I can install new programs on easily m.r.bob Linux - Distributions 25 02-15-2006 05:04 PM
Accidental Install of Windows Second....Install GRUB? Brnzwngs Linux - Newbie 6 08-12-2005 01:10 PM
Install OpenOffice post Distro install? xrobevansx Linux - Newbie 4 06-15-2004 05:43 AM

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

All times are GMT -5. The time now is 01:09 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