LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to tell GRUB2 which partition's grub.cfg to read? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-tell-grub2-which-partitions-grub-cfg-to-read-4175457204/)

jhooly 04-07-2013 03:44 AM

how to tell GRUB2 which partition's grub.cfg to read?
 
i've been using various linux distros for about 18 months, still running on an old WinXP box. at the moment i have about a dozen linux variants installed on my main hard drive though XP is still there and i do need to keep it around for the time being. i think i'm still pretty n00b, don't actually know much, so i opted to post here in the Newbie forum.

the trouble i've encountered with my distro hopping is that it's always a gamble with GRUB when doing a new distro installation: some are well behaved and ask you if they can mess with GRUB, others not so much and they just go ahead and do it. in other words if you've had a nicely tweaked grub menu on one particular partition you might lose access to it because of a new install.

for instance, as part of my linux learning process, i have a well-hacked version of grub.cfg (please see below for more on this) sitting on one particular install partition, Mint 14 on /dev/sda10 as it happens and this is currently my main working installation.

of course i've been going about my distro hopping ways and tried Bodhi 2.3.0 the other day and sure enough, it stomped on GRUB and now the boot menu on it's partition -- sda12 -- is what i saw when my system rebooted. trouble is that boot menu includes the results of OS-prober and to make a long story short it sucks and i want to go back to using my tweaked and tailored boot menu from sda10. i know i'll have to hack in the menuentry for Bodhi in order to have access to it but that's old news for me at this point and i have no fears that i'll be able to manage it.

so, the question is: how do i tell GRUB to go to sda10 (Mint 14) for grub.cfg instead of sda12 (Bodhi 2.3.0)?

i should mention a few things:

(1) i know i can just copy the preferred grub.cfg over to sda12 -- already done it -- but that's not really the solution of choice because, as it happens, i'll probably dump Bodhi in a few weeks and so ... i'll still need to tell GRUB where to look blah blah blah.

(2) i know that hacking grub.cfg is not the "right" way to do things. truth is (a) it works for me now and (b) i'll learn how to do the custom menu stuff later. as i see it there is value in messing with grub.cfg because you learn a hell of a lot about what GRUB is up to, etc. that's why i say i'm doing this for the learning and i'll learn the right way later.

(3) i'm pretty familiar with the Boot Rescue boot disc and have used it a lot. unfortunately is seems to assume that you don't want to do what i want to do which is tell GRUB to go to a particular partition for the grub/boot menu files. when you start BR it already knows which partition GRUB redirects to and doesn't appear to offer you the opportunity to change that, afaik.

(4) i have trolled around through forums and man pages for the answer but all i find is a ton of other stuff that is all very interesting but it doesn't answer my immediate question. hence my immediate question, here.

any assistance much appreciated.
ty.

spiky0011 04-07-2013 04:07 AM

Hi

Have a look here
http://askubuntu.com/questions/14809...ult-boot-entry
sorry i,m not on linux at the moment but that should fix it

catkin 04-07-2013 04:08 AM

If you install each distro in its own partition then how about installing the distro's boot manager into the partition boot sector and the partition's /boot directory rather than the disk's boot sector and a /boot partition -- and chainloading the partition boot loader from the disk's boot loader?

The advantages of this scheme are that each new distro doesn't add clutter to the disk's boot loader and is automatically discarded when you install another distro. You don't even have to change the disk's boot loader config -- it can continue to have an entry to chainload sda12 (or whatever).

I read somewhere that GRUB2 does not support being used as a partition boot loader but I ran it that way with Ubuntu 12.04 in the partition without a problem (except for feeling tainted by having Ubuntu installed :D).

EDIT: that assumes the distro installation does allow installing its boot loader to its partition instead of the disk. Backups are prudent :jawa:

spiky0011 04-07-2013 04:23 AM

Hi

I have done a blog on installing grub2 as a standalone it might help, It dosn,t require any OS to be installed to run,The only thing I cant get right is the chainload that catkin mentioned for distros on extended partition

syg00 04-07-2013 04:38 AM

Quote:

Originally Posted by jhooly (Post 4926719)
so, the question is: how do i tell GRUB to go to sda10 (Mint 14) for grub.cfg instead of sda12 (Bodhi 2.3.0)?

On Ubuntu-derived distros "update-grub" should work. So just boot into Mint, and run it.

Else see the doco for grub-mkconfig. Won't work for Fedora of course, but they always like to be non-conforming ...

jhooly 04-07-2013 05:22 AM

lots to investigate! my thanks to all.

bloody 04-07-2013 10:13 AM

The "--root-directory=/path" for the grub-install command can tell the bootloader where to look.


All times are GMT -5. The time now is 05:29 AM.