LinuxQuestions.org
Help answer threads with 0 replies.
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 10-02-2010, 09:17 AM   #1
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
grub2 indirect booting from separate partition


I have multiple distros that I chainload and I have installed a grub2 shell to the partition and can boot manual. I can not seem to get a grub.cfg file to work. Is there a directory that needs to be built for this file?
 
Old 10-02-2010, 11:46 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
grub2 is completly different from grub "legacy".
Do not make changes to directly to grub.cfg this is a generated file.
There is quite good documentation for grub2 here: https://help.ubuntu.com/community/Grub2

Once you have installed grub2 you probably just need to run update-grub (as root), but please read the documentation first.
 
Old 10-02-2010, 01:20 PM   #3
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100

Original Poster
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I have read and do not fully understand, I want it to stand alone in a boot partition fully independent of any distros. I have no problems installing it to boot from this partition but it still uses the ubuntu /etc partition. The reason I want it independent is so if I upgrade ubuntu tomorrow I will not have to redo grub. I know with grub2 this is not much of a problem except upgrade-grub has trouble getting the names of some of the ext2 and 3 distros. Once installed to boot indirect grub legacy it never used to give any problems.

Last edited by Larry Webb; 10-02-2010 at 01:21 PM.
 
Old 10-02-2010, 02:13 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I have read and do not fully understand, I want it to stand alone in a boot partition fully independent of any distros.
By "it", I assume you mean grub2, and the best place (for me) has been to put grub2 is on the MBR of the first disk.

When you do grub-install, grub2 looks at all partitions, and finds bootable OSs. It then puts them in a menu for the next boot.

grub2, like grub "legacy" still needs to keep its /boot/grub/* files on a partition somewhere.

If you have several OSs then the solution that works for me is to make one partition just for /boot.
That's where grub will keep ALL its config files. Also the real files of the different kernel versions. And it "just works": Boots the selected kernel, then mounts the appropriate root for the selected kernel/distro.

I learnt (the hard way) that if you have multiple distros, each with their own /boot directory, on different partitions, chaos can easily happen. So now I always select, at install time, to have /boot as a single, separate partition, and use the same one always. All distros install their boot files there. Which file is selected to be the kernel at boot time is decided by grub ( "legacy" or grub2 )

You can (temporarily) get around this (clumsily) by copying vmlinuz.* System.map.* initrd.img.* config-* and abi-* from your running kernel's /boot directory to the /boot directory of the partition grub(legacy or 2) thinks is its base.

If this doesn't help you, please search on the LQ user Saikee, who seems to be the LQ boot guru.

Best wishes.
 
Old 10-02-2010, 05:37 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
@tredegar, I think you've missed the point.
If you need to update the menu you (should) update /etc/defaults/grub, custom entries go in /etc/grub.d/
They are not likely to be on a /boot partition.

Larry, try something independent of the distro like gag. I tried it years ago, but desisted because (legacy) grub did all I needed, as I needed. Grub2 doesn't.
Just had a look - it appears to use the "unused" sectors after the MBR. This won't work for gpt disks (grub2 suffers the same issue).
 
Old 10-02-2010, 06:11 PM   #6
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100

Original Poster
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I may go back to my old way, just thought I would try and get modern. I will give it a short rest before deciding and maybe someone will come up with a solution. If nothing else I guess I could strip down an ext4 distro to boot with and then chainload the rest of my distros. As long as I use grub2 just ignore the distro. It just seems to be a work around and a waste.

syg00 I will check into alternatives, grub2 seems to have some good points but I think there could be a simpler file stucture.

Last edited by Larry Webb; 10-02-2010 at 06:16 PM.
 
Old 10-02-2010, 06:31 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
I use legacy grub as my control - separate boot partition, patched for the larger inode support for ext[34] and chainload like you.
I install grub2 in the partition boot sector - it complains, but seems to work. So far.
 
Old 10-16-2010, 11:00 AM   #8
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100

Original Poster
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
After taking a couple of weeks off I came back and accomplished getting grub 2 with its own partition chainloading all ext files. After getting the grub shell installed on the partition just make a grub.cfg file and install it in /boot/grub/. It will not automatically update, you will have control every time it boots. This was an education for an old man set in his ways.
 
Old 12-18-2010, 06:53 PM   #9
maddes.b
LQ Newbie
 
Registered: Aug 2009
Location: Germany
Distribution: Debian, OpenWrt
Posts: 23

Rep: Reputation: 1
@Larry
Can you describe your solution a little bit more in detail. Thanks.

I want to have Grub2 separately as a stand-alone boot manager in his own partition.
So it doesn't matter what OS I install or what image I restore in my three different OS partitions.

Right now, I can only think of a minimalistic stand-alone Ubuntu/Debian Linux, which just contains Grub2.
Then chain load all other partitions, no matter if Linux, Windows or whatever.
Or do I miss something?

Last edited by maddes.b; 12-18-2010 at 06:55 PM.
 
Old 12-19-2010, 12:35 PM   #10
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100

Original Poster
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
First I partition my hds. My grub partition I try to make at approx. 2 meg. This partition can be the first, second, third or so on - primary or logical. This computer had two hds and I made the first partition of my second hd grub. I do all this work from a live cd that uses grub2.

Here are the steps I took after partitioning the hd.

All these commands from terminal of the live cd

sudo mkdir /media/sdb1
sudo mount /dev/sdb1 /media/sdb1
sudo mount /dev/sda
sudo grub-install --root-directory=/media/sdb1 /dev/sda
sudo umount /dev/sdb1
sudo rmdir /media/sb1
sudo umount /dev/sda

Next you will need a grub.cfg file using a text editor. I used to try and make these first but always had so many changes that I wait till last.

This is part of my grub.cfg

set timeout=12

set default=0

menuentry "Suse 11.2 @ sda5" {
set root=(hd0,5)
chainloader +1
}

menuentry "Windows XP SP3 @ sda1" {
set root=(hd0,1)
chainloader +1
}

menuentry "Tiny Me @ sdb3" {
set root=(hd1,3)
chainloader +1
}

menuentry "Ubuntu 10.04.1 @ sdb5" {
set root=(hd1,5)
chainloader +1
}


Once this is made and saved in Documents you need to install again from terminal

sudo mkdir /mnt/sdb1
sudo mount /dev/sdb1 /mnt/sdb1
cp /home/user/Documents/grub.cfg /mnt/sdb1/boot/grub
sudo umount /dev/sdb1
sudo rmdir /mnt/sdb1
exit
reboot

Hopefully I have not missed a step.

This is the rough image, I also change the timeouts in the installed distro loaders to '0'.

Last edited by Larry Webb; 12-19-2010 at 01:18 PM.
 
  


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
booting remastersys iso using grub2 anandogc Linux - Software 5 08-27-2010 07:39 AM
Booting from an .iso on a separate partition? MajorTom05 Linux - Laptop and Netbook 3 07-17-2010 08:49 AM
[SOLVED] Booting Debian ISO with grub2 and a separate Kernel deepclutch Linux - General 4 05-23-2010 05:30 AM
[SOLVED] Problem in Booting Linux(GRUB2) Kcghost Linux - Software 1 12-04-2009 06:11 PM
[SOLVED] Creating and booting from a separate /boot partition eldiener Linux - General 5 11-12-2006 06:13 PM

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

All times are GMT -5. The time now is 03:01 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
Open Source Consulting | Domain Registration