LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-17-2009, 09:17 AM   #1
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 219

Rep: Reputation: 36
Any way to repair grub in partition other than MBR.


I have ubuntu installed in sda1 and ubuntu's grub is in mbr.
Ubuntu's grub will chainload any other distro's grub installed in their respective partition.

Just install Debian in sda2 and somehow Debian's grub is not installed.

Is there any way that I can install/repair Debian's grub into sda2 partition without affecting
- Ubuntu's grub (in mbr).
- Debian's installation (ie. without reinstalling Debian)

Thanks in advance for help.
 
Old 02-17-2009, 09:41 AM   #2
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Sure, you can install Grub to the boot sector of the Debian partition while you are in Ubuntu:
Code:
sudo grub
grub> root (hd0,1)
grub> setup (hd0,1)
grub> quit
Then you should be able to chain load Debian's Grub from your Ubuntu menu.lst. Let me know how that goes or if you run into problems.
 
Old 02-17-2009, 12:40 PM   #3
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by CJS View Post
Code:
sudo grub
grub> root (hd0,1)
grub> setup (hd0,1)
grub> quit
This would be wrong because there should be letter "s" instead of the letter "h",but anyway,I think that Debian's GRUB is already installed on the Debian's root partition,so all there has to be done is to open /boot/grub/menu.lst in Ubuntu and add an entry for Debian since the Debian was installed after Ubuntu and that's way Ubuntu didn't recognized Debian automagically.
 
Old 02-17-2009, 12:54 PM   #4
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Quote:
Originally Posted by alan_ri View Post
This would be wrong because there should be letter "s" instead of the letter "h",but anyway,I think that Debian's GRUB is already installed on the Debian's root partition,so all there has to be done is to open /boot/grub/menu.lst in Ubuntu and add an entry for Debian since the Debian was installed after Ubuntu and that's way Ubuntu didn't recognized Debian automagically.
I would suggest that you check out the official Grub manual, because you will see that Grub never uses (sdX,Y) notation; all drives, whether IDE or SATA, are (hdX,Y) to Grub. Also, the disadvantage of adding Debian's boot stanzas to Ubuntu's menu.lst is that you would have to do that manually every time Debian gets a kernel upgrade. That's the advantage of "chain loading" Debian's menu.lst from Ubuntu: you never have to worry about updating Ubuntu's menu.lst when Debian gets new kernels. Another method that can work is to link to Debian's menu.lst via the "configfile" notation:
Code:
title Debian Grub Menu
configfile (hd0,1)/boot/grub/menu.lst
The advantage of that is you don't have to first install Grub to the boot sector of the Debian partition as you do when you chain load; but the disadvantage is that some distros like OpenSUSE use gfxboot for eye candy, so linking to its menu.lst via "configfile" doesn't work well. But in the case of Debian, it would probably work fine. Always the safest approach is chain loading, because then the distro you want to add to the Grub menu uses its own version Grub to load its own menu.lst.
 
Old 02-17-2009, 01:47 PM   #5
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
What about command;
Code:
grub-install /dev/sda
Will that work?

What about when you want to install GRUB on the floppy disk?Would you then use "s" or "h"?
 
Old 02-17-2009, 02:08 PM   #6
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Quote:
Originally Posted by alan_ri View Post
What about command;
Code:
grub-install /dev/sda
Will that work?
That command will install Grub to the MBR and point Grub to the partition that you run the command from for its boot files. If you want to use the grub-install command to install Grub using the boot files from another partition, and also install Grub to the boot sector of that partition (michalng's case), you have to mount that partition and do:
Code:
grub-install --root-directory=/mounted_sda2_partition /dev/sda2
But the only time you need the grub-install command is if Grub's boot files don't all ready exist in /boot/grub. If the partition all ready has the boot files installed (which would be michalng's case), then it is generally better to use the Grub CLI to install Grub to the boot sector of the partition and use the all ready existing Grub boot files.
Quote:
Originally Posted by alan_ri View Post
What about when you want to install GRUB on the floppy disk?Would you then use "s" or "h"?
Actually neither, you would use (fd0) in the Grub CLI.
 
Old 02-17-2009, 02:29 PM   #7
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
So,I've made my point.The thing is,I know that I made Lapsus Memoriae and I was wrong and you were right about "h" but also I was right about "s" for what I had in mind,also,as I've said within the question,GRUB can use "f" and now that you've confirmed that GRUB can use "s" and "f" I believe that we understand each other.That said,just to clarify,I didn't need your explanation for "How GRUB works" I just wanted you to say that GRUB can use "s" and "f".
Hope that this little discussion of ours will make some things clearer for someone.
 
Old 02-17-2009, 03:12 PM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
Do you have any particular reason for chainloading grub to grub ? I mean, in most cases you don't have to, in fact it's senseless. Just tell it where the kernels are and it'll boot them, no need for chainloading.
 
Old 02-17-2009, 05:14 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Quote:
Originally Posted by H_TeXMeX_H View Post
Do you have any particular reason for chainloading grub to grub ? I mean, in most cases you don't have to, in fact it's senseless.
Quite the contrary.
When the second (or fifth, ...) distro ships a new kernel they will update their config file. You will see it automatically.
Stops people wondering why they aren't seeing that upate when they neglected to continually update their manual config.
 
Old 02-17-2009, 05:48 PM   #10
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by CJS View Post
Sure, you can install Grub to the boot sector of the Debian partition while you are in Ubuntu:
Code:
sudo grub
grub> root (hd0,1)
grub> setup (hd0,1)
grub> quit
Then you should be able to chain load Debian's Grub from your Ubuntu menu.lst. Let me know how that goes or if you run into problems.
Got it working , thanks for the help !
 
Old 02-18-2009, 04:13 AM   #11
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
Quote:
Originally Posted by syg00 View Post
Quite the contrary.
When the second (or fifth, ...) distro ships a new kernel they will update their config file. You will see it automatically.
Stops people wondering why they aren't seeing that upate when they neglected to continually update their manual config.
Sorry, but I don't get it, try again.

Grub will boot just a kernel, it doesn't really need anything else, just the HDD and partition and the path to the kernel. So, I don't get what you're saying.
 
Old 02-18-2009, 05:17 AM   #12
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
...and what if we have a line in /boot/grub/menu.lst for OS that we want to add to GRUB that looks like this;
Code:
kernel /boot/vmlinuz root=/dev/hda1
Would you say that there is a need for chainloading then?
 
Old 02-18-2009, 05:22 AM   #13
michalng
Member
 
Registered: Dec 2005
Distribution: Debian KDE / Fluxbox
Posts: 219

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by H_TeXMeX_H View Post
Sorry, but I don't get it, try again.

Grub will boot just a kernel, it doesn't really need anything else, just the HDD and partition and the path to the kernel. So, I don't get what you're saying.
Believe what syg00 means is,

if today debian's kernel is 2.6.26-1-686, the manually updated (not-debian) grub will be pointing to it.

However, if tomorrow there's a new kernel 2.6.28.1-686, an update will only cause an update to debian's own grub menu, in my case hidden in debian's own boot partition (not inside mbr). The original (not debian's) grub at mbr will not be updated automatically.

Chainloading will thus solve this "problem" of "not seeing that update".

Hope I get this right
 
Old 02-18-2009, 05:45 AM   #14
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You could update the second Linux's grub in it's own MBR, and then copy it's stanza from the second menu.lst to the main MBR's menu.lst file. You could keep the chainloading stanza for insurance. Hopefully you will be able to boot directly instead of chainloading.
 
Old 02-18-2009, 06:21 AM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Way too hard @jschiwal - I have dozens of systems, and I also build my own kernels.
@alan_ri has the right idea - except that as I said, I have so many kernels, that little kludge ain't gunna fly.

But this is Linux - enough choices to satisfy everyone.
 
  


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 determine which Linux partition w/ Grub controls the MBR? CJS Linux - General 3 06-23-2008 09:26 AM
can I build a mbr in a ntfs partition and install grub to it rbees Linux - General 5 02-02-2008 08:22 PM
Messed up my MBR, now GRUB and Extended Partition Info lost Q-Continuum SUSE / openSUSE 16 05-07-2007 03:29 AM
Getting rid of GRUB on a partition (NOT MBR) KuRe Linux - Newbie 1 03-31-2005 09:06 PM
Help with Grub in MBR and /boot partition! zLinuxz Linux - General 11 11-17-2003 12:42 PM


All times are GMT -5. The time now is 06:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration