single *_grub_* partition for many distros

Goh Lip g.lip at gmx.com
Sat Sep 26 10:46:46 UTC 2009


Joe, I think you had inadvertently sent to my direct email rather than 
the mailing list. So I copied and add as subject matter your proposed 
subject header.

Joe Philbrook wrote:

> I think this grub2 discussion has gotten far enough off topic from
> a thread about "Partition problems" That it was time to move the discussion
> to a New thread... And no, I doubt I'd really want to switch back to lilo.
> But some of the changes their making for grub2 makes it amusing to think
> about. Like something I gleaned from another thread, that your not
> "supposed" to edit the grub.cfg... Wasn't one of the things grub used to
> brag about was how simple it was to just edit grubs configuration file???
> 

I guess it would be simple for people who can write in xml. :) Seems 
that the modules in /etc/grub.d are in xml. But I think editing grub.cfg 
is no different than editing menu.lst. Just that methods for handling 
grub2 is different than in grub-legacy. It's always more of a hassle 
when we relearn changes in stuff we know than just learning a new stuff.


> It would appear that on Sep 25, Goh Lip did say:
>  {in Message-ID: <h9ghbi$3rl$1 at ger.gmane.org>
>   with a "Subject:"of "Re: [single *_grub_* partition for many distros]"}
>> > 
>> > Joe(theWordy)Philbrook wrote:
>> > 
>>> > > 
>>> > > Does that mean that "grub legacy" is incapable of booting Karmic without
>>> > > chainloading??? 
>> > 
>> > Yes, Joe, that is correct; you need chainload.
> 
> I really hope your wrong about that. But I suppose I'll just have to live
> with it if your right. Certainly the chanloaded boot will be at least,
> easier...

Yes, you can always keep your 'grub partition' (sda3) in grub-legacy and 
boot karmic by chainloading. But I did change my 'grub partition' and 
hardy grub to grub2 because sooner or later, all things will be in 
grub2. In fact, grub-legacy has not been maintained for many years now, 
I guess at least 5 years? That is why others come up with super grub and 
so on. My own experience on this change is that it is not more difficult 
than creating my 'grub partition' the first time in grub-legacy. Of 
course, maybe I had this experience (of grub-legacy) that makes it easier.


>>>> > >> When new kernels emerge, just edit say 2.6.31-10 to 2.6.31-11)
>>>> > >> In short, you need not copy new kernels or initrds to sda3 under any 
>>>> > >> circumstance.

Note I just done exactly that 30 minutes ago.


>>> > > 
>>> > > Except that I use:
>>> > > 
>>> > > root            (hd0,2)
>>> > > 
>>> > > for ALL of my grub entries that do not chainload the Distro's native grub. 
>>> > >
>>> > > and then once I'm looking at /boot on one mc panel, and /root/boot on the
>>> > > other... the rest is easy.
>> > 
>> > Thanks for sharing, I'll append my example below.
> 
> THANK YOU! those examples may just keep me from pulling what little hair I
> have left out by the roots...

Guess i still have a full head of hair to afford. :)

>>>> > >> o grub2 allows boot to iso files through looping, so if you have a 
>>>> > >> livecd or other programs (gparted, anti-virus etc), you need not burn 
>>>> > >> and run through cd boots. You may want to include entries at your sda3 
>>>> > >> to do just this.
>>> > > 
>>> > > This is the first thing I've heard to make me even 'think' about switching
>>> > > to grub2... 
>> > 
>> > It's something that many find useful, I personally don't use this as I 
>> > normally don't use gparted, livecd or antivirus. There are some small 
>> > programs (not OS, I temporarily forget their names) on livecd that some 
>> > find very useful.
> 
> Me either, but most linux installation cd/dvd images seem to also be live
> cd/dvd images nowadays... If this method works well I wouldn't need to waste
> a disk, just to find out if I'd like to switch out one of my older installs
> for it...
> 
> Which reminds me, If it can boot an iso to correctly run something that
> "thinks" it's a livecd, would it not also work to actually install a linux
> directly from said iso" (that is, as long as the install doesn't disturb
> the partition that grub2 is using, nor the partition the iso itself is on?)
> 
> Because THAT would be a good reason to switch...

Again Joe, I have no experience with this. Let us know when you do.
I have been thinking, just thinking only, whether it is necessary to 
have the iso in the same partition as the boot/grub. Then this menu 
entry should be in the 2nd grub and the iso in that 2nd grub partition, 
as my 'first grub partition' is only 150 MB. Let us know when you do, ya?


>>>> > >> o For any new installation, it will by default set it in mbr, in 
>>>> > >> kubuntu, you can circumvent this by setting this to the OS / partition. 
>>>> > >> If you forget, you can always reset the sda3 grub back. {one funny thing 
>>>> > >> though, in karmic where grub2 is default, the naming convention for 
>>>> > >> setting this is still (hd0,4) for sda5, for example, while grub2 
>>>> > >> convention should be (hd0,5), but that was in alpha1, does anybody know 
>>>> > >> how it is in alpha6?}
>> > 
>> > I found that out recently, to avoid confusion, Karmic alpha6 asked which 
>> > partition to install grub as sda x rather in (hd0,x). Very thoughtful of 
>> > them. But it 'scolds' you if you don't install to sda: "it is a very bad 
>> > thing to do that!" That's cute.
> 
> Yeah, cute! If their going to say "it is a very bad thing" when you select
> to install to a partition rather than the mbr, they should also say why.
> Because if their strongest argument is that some other bootloader will have
> to chainload the partition before Karmic's can start, then it's "NOT SUCH
> A BAD THING" after all...
> 
> But if they stopped hiding the choice in the "advanced" options so that the
> uninitiated might figure out that there is a choice, then I'd forgive them
> for a lot more than a "cute" scolding...

Yes, it is still hidden under 'advanced'.

> 
>> > 
>>> > > I suppose I could live with the idea that most new users would find a
>>> > > numbering schema that started with 1 instead of 0 less confusing.
>>> > > especially if the numbering schema was applied across the board to both
>>> > > drives and partitions. But to have to remember that drives are numbered
>>> > > one way, while partitions are numbered another would be most annoying.
>> > 
>> > Unfortunately, that is correct.
> 
>  sigh!
>  
>>>> > >> o Grub2 come with new commands and methods and we need to relearn all 
>>>> > >> this. My only concern is that these are done through the linux command 
>>>> > >> lines and not at the grub> shell. So if all my linux OS 
>>>> > >> fails...(unlikely, but...still my 'sda3' will boot to new and working 
>>>> > >> installations)
>>> > > 
>>> > > Wait a minute. It took me a LONG time to get used to the grub shell. But 
>>> > > now the idea of phasing it out in favor of direct Linux commands is very
>>> > > disturbing. Please tell me that you mean that there are new Linux commands
>>> > > that can manipulate grub2 for me, but that grub2 itself still incorporates
>>> > > the grub shell.
>>> > > # grub
>> > 
>> > Unfortunately, that is also correct. A further comment is that grub2 is 
>> > still under construction, when I installed the 'first grub' partition 
>> > (your sda3) not too long ago, it has gone through 3 revisions. But, I 
>> > can say they are improvements. I installed my 'sda3' the old fashioned 
>> > way, but I think there is a nice trick to do this now.
>> > 
>> > There are some nice commands like 'search' and 'ls' in the grub.sh> 
>> > shell (esc at grub menu, or grub-emu /dev/sdax) to look for partitions 
>> > that boot, Other than that most commands are executed at the linux 
>> > command line.
>> > 
>> > 
>> > Joe, below are my examples of entries in grub.cfg (in your sda3)
> 
> Looking at your examples below Goh, I've got a couple more questions. First
> is about *_NOT_* using {long string of imaginative expletives deleted} UUID
> to identify a partition. For instance, If I install karmic on /dev/sda5
> would I be able to use something like this??? :
> 
> menuentry "Karmic" {
>   	set root=(hd0,5)
>   	linux	/boot/vmlinuz-2.6.31-10-generic root=/dev/sda5 ro vga=normal
>   	initrd	/boot/initrd.img-2.6.31-10-generic
>   }


I would think so, just that I just copied the same stuff from Karmic. I 
also understand why you want to this. Before doing it, make a copy of 
old, just in case.


> I've never used insmod...  Does the "insmod ext2" in your example mean
> grub2 needs such a line to work with the classic ext2 filesystem???

No, it is not necessary; just that it was generated in karmic grub and I 
just copied over. My karmic is in ext4, yet the grub generated "insmod 
ext2". What purpose it served? I haven't figured that out yet.


> Also, in YOUR karmic example below , you specify which partition grub2
> thinks of as root with the "set root=(hd0,5)" line, AND specified the
> partition the linux kernal will use as root via the "root=UUID=..."
> kernel argument... So what does that search command line that specifies the
> same UUID do for you???

The search can search for partitions as well as UUID, and as in 
grub-legacy, we can boot not just by UUID, but by partition number or 
label also.

>> >   menuentry "Config " {
>> >   	configfile (hd0,8)/boot/grub/grub.cfg
>> >   }
>> > 
>> > 
>> > 
>> >   menuentry "Chain " {
>> >   	set root=(hd0,2)
>> >   	chainloader +1
>> >   }
>> > 
>> > The above 2 entries will be sufficient to load any OS.
>> > configfile for grub2 and chainload for windows and grub-legacy.
>> > 
>> > If you miss any partition, you can modify the (hd0,x) by 'e' button at 
>> > grub menu and boot.
>> > 
>> > As I mentioned earlier, I copy and paste the grub2 entry from say the 
>> > Karmic OS and boot, avoiding the 2nd boot and 3 secs!
>> > 
>> > 
>> >   menuentry "Karmic" {
>> >   	set quiet=1
>> >   	insmod ext2
>> >   	set root=(hd0,5)
>> >   	search --no-floppy --fs-uuid --set c4aea9ce-65c8-415d-ac28-da51478e8053
>> >   	linux	/boot/vmlinuz-2.6.31-10-generic 
>> > root=UUID=c4aea9ce-65c8-415d-ac28-da51478e8053 ro   quiet splash
>> >   	initrd	/boot/initrd.img-2.6.31-10-generic
>> >   }
>> > 
>> > 
>> > Note, I have mentioned earlier, in the case of grub2, when kernel 
>> > upgrades to say, 2.6.31-11, I just need to change only this number in 
>> > grub.cfg *WITHOUT* the need to copy over the config, initrd or vmlinuz 
>> > files to /sda3/boot/ as we may have to do in grub-legacy.
>> > Also note, I don't modify my OS grub at all, as was the case previously 
>> > with grub-legacy as well.

Ditto, just done exactly that. No copying over of config, initrd or 
vmlinuz files.

>> > 
>> > Lastly, there is no harm just to copy over windows entry from karmic,
>> > 
>> >   menuentry "Wins7" {
>> >   	set root=(hd0,4)
>> >   	search --no-floppy --fs-uuid --set 387fab3b1ed0ef51
>> >   	drivemap -s (hd0) ${root}
>> >   	chainloader +1
>> >   }
>> > 
>> > 
>> > Now, a sample of an entry with livecd and looping.
>> > 
>>> > > #menuentry "Iso-boot" {
>>> > > #	insmod ext2
>>> > > #	set root=(hd0,6)
>>> > > #	search --no-floppy --fs-uuid --set 79c013db-b497-4cba-a693-02317cf22c13
>>> > > #	loopback loop /mnt/karmic-netbook-i386.iso
>>> > > #	linux (loop)/mnt/iso/casper/vmlinuz boot=casper iso-scan/filename=/mnt/karmic-netbook-i386.iso quiet splash
>>> > > #	initrd	(loop)/mnt/iso/casper/initrd.lz
>>> > > #}
>> > 
>> > A big caveat please! I have not used or tested this! Just entering it 
>> > expecting modifications if need be. Note it is commented out. If 
>> > somebody has experience on this, please correct.


Good luck,
Regards,
Goh Lip






More information about the kubuntu-users mailing list