LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2008, 09:56 PM   #1
linuxawe
LQ Newbie
 
Registered: Jun 2008
Posts: 11

Rep: Reputation: 0
howto : install grub on mbr ??


how can i install grub on MBR ???
pleas ?
 
Old 06-09-2008, 09:59 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,751

Rep: Reputation: 272Reputation: 272Reputation: 272
As either root or by using sudo issue the grub-install command. Assuming that your MBR is on /dev/hda then the command is:

grub-install /dev/hda

http://linux.die.net/man/8/grub-install

---------------------
Steve Stites
 
Old 06-09-2008, 10:11 PM   #3
linuxawe
LQ Newbie
 
Registered: Jun 2008
Posts: 11

Original Poster
Rep: Reputation: 0
mmmh i tried this command from liveCD and but its gave me an error :

root@ubuntu: mount -t ext3 /dev/sda5 /mnt/h/

root@ubuntu:/mnt/h# grub-install /dev/sda5
Could not find device for /boot: Not found or not a block device.

so ?
 
Old 06-09-2008, 10:56 PM   #4
linuxawe
LQ Newbie
 
Registered: Jun 2008
Posts: 11

Original Poster
Rep: Reputation: 0
and also gave an error when using #grub

grub> setup (hd0,4)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "embed /boot/grub/e2fs_stage1_5 (hd0,4)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0,4) /boot/grub/stage2 p /boot/grub/menu
.lst "... succeeded
Done.
 
Old 06-09-2008, 11:11 PM   #5
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Quote:
Originally Posted by linuxawe View Post
root@ubuntu: mount -t ext3 /dev/sda5 /mnt/h/

root@ubuntu:/mnt/h# grub-install /dev/sda5
Although I'm not sure if Ubuntu live CD mounts in read/write mode with that command, it may only mount it in read only, perhaps a more knowledgeable Ubuntu live user can elaborate.

In your second command you asked grub to install itself in the boot sector of the 6th partition, if you want it installed in the MBR you must not specify a partition. Something like: grub-install /dev/sda would be more appropriate if you want it in the MBR.
 
Old 06-09-2008, 11:14 PM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Normally I would use the four commands below without mounting, assuming the grub configuration file you want to use (if you have more than one) is in the 6th partition, (this being the /boot or / partition).
Code:
sudo grub
root (hd0,5)
setup (hd0)
quit

Last edited by Junior Hacker; 06-09-2008 at 11:17 PM. Reason: elaborated
 
Old 06-10-2008, 01:42 AM   #7
linuxawe
LQ Newbie
 
Registered: Jun 2008
Posts: 11

Original Poster
Rep: Reputation: 0
tnx , its working okay now
but how can i add SUSE on other HD to grub.menu ?
juts i have add the root and kernel of SUSE ? or what ?
 
Old 06-10-2008, 06:57 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
To add other systems to the boot menu, you simply edit the file: /boot/grub/menu.lst
If you have several OSes installed, you have to choose the correct partition--the one to edit is the one specified as "root" when GRUB was installed (this gets "hard-coded" into the GRUB code that goes in the MBR.

Example:
Suppose you install Linux on sda1 (grub calls this hd0,0) and install GRUB in the process. The "root" for this GRUB install will be sda1 / hd0,0.
Next you install another Linux on sda1 (grub = hd0,1):
If you let it install GRUB, then the new root for GRUB would be sda2 / hd0,1. this would be the location of the menu.lst file to edit.
Otherwise, if you did not install GRUB with the 2nd Linux, you would continue to edit the file on sda1.

See the "booting" link below for more info.
 
Old 06-10-2008, 07:28 AM   #9
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
You will need to edit you menu.lst. There are a couple of different ways to accomplish this. The easiest for me has been the indirect method. Probably the easiest way for you would be to find the /boot/grub/menu.lst in your Suse installation and coping and paste to your ubuntu /boot/grub/menu.lst (direct method). Another way is to put grub in the root of Suse by this command
sudo grub
root (hdx,x)

In the root command change the x's to the hd and partition number, do not forget grub starts counting from 0.

Now open your ubuntu /boot/grub/menu.lst and add this to the menu.lst

title Suse
root (hdx,x)
chainloader +1

There are more articles on this that probably describe the methods better than this but if there is something you do not understand or does not work do ask back because a lot of times we can not understand what you do not understand.

Last edited by Larry Webb; 06-10-2008 at 07:30 AM.
 
Old 06-10-2008, 08:02 AM   #10
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
gksudo gedit /boot/grub/menu.lst
 
Old 06-11-2008, 08:17 PM   #11
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Quote:
Originally Posted by linuxawe View Post
tnx , its working okay now
but how can i add SUSE on other HD to grub.menu ?
juts i have add the root and kernel of SUSE ? or what ?
If the second hard drive with SUSE is installed and configured in the bios, the four commands I mentioned should also include it in the menu providing you chose to install grub in it's /boot or / partition during installation. "Possibly" even if you chose to install grub in the MBR of that drive.
The "root" command specifies which root or /boot partition containing the grub configuration you want to use.

Last edited by Junior Hacker; 06-11-2008 at 08:40 PM. Reason: Added a bit
 
Old 06-11-2008, 10:55 PM   #12
linuxawe
LQ Newbie
 
Registered: Jun 2008
Posts: 11

Original Poster
Rep: Reputation: 0
mmmmmmmmmmmh

Last edited by linuxawe; 06-11-2008 at 11:44 PM.
 
Old 06-11-2008, 11:43 PM   #13
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Previously you used a partition on the first drive as your root, (hd0). This is the grub configuration of the Linux installation you want to use to boot the works. Now it appears you are trying to use a grub configuration on the second drive, which is wrong.
If you previously specified the Ubuntu partition on the first drive as your root, you should stick with it and specify the same one, not the SUSE partition.
When using those four commands, you need not mention anything about the second drive, just point grub to use the configuration you pointed it to last time, and point it to setup in the first drive like you did before.
Basically, all you need to do is plug in the second drive and issue the same commands. If Ubuntu is installed in /dev/sda5, your commands should look like so:
Quote:
sudo grub
root (hd0,4)
setup (hd0)
quit
 
Old 06-11-2008, 11:43 PM   #14
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
It might help if you could give us the results of 'fdisk -ls'. I think there is something we are missing.
 
Old 06-11-2008, 11:49 PM   #15
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Unless...
You neglected to mention you pulled out the first drive and installed the second in it's place or something out of the ordinary.
I'm assuming by the quote below that you wanted to add SUSE to Ubuntu's menu.lst.
Quote:
but how can i add SUSE on other HD to grub.menu ?
juts i have add the root and kernel of SUSE ? or what ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install GRUB in MBR? concoran Linux - Newbie 9 03-08-2008 01:30 AM
re-install grub to mbr nomb Fedora 1 11-19-2007 11:09 AM
Grub won't install in MBR PB0711 Linux - Software 4 05-02-2007 02:12 AM
how do i install grub in the mbr? spyghost Linux - Newbie 2 11-07-2003 10:52 AM
GRUB Install on MBR JakeFarley Linux - Newbie 3 10-22-2002 08:16 AM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration