[single *_grub_* partition for many distros]

Goh Lip g.lip at gmx.com
Thu Sep 24 19:29:50 UTC 2009


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.


>> o You need not mount this grub partition (sda3) at all.
>  
> I usually only mount it to copy and edit files when I make changes in it.

Then that's what I do also. Otherwise, I leave this partition alone.



>> 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.
> 
> 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.

>> 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.

>> 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.

> 
> Do you mean that grub2 is supposed to stop numbering it's partitions 
> with "0"???? so that it should now refer to the first partition of the first
> drive as (hd0,1)??? If they were going to do this then for consistency sake
> they should also start numbering the hard drives with 1 also...
> IE making the first harddrive (hd1) instead of (hd0). Personally I'd prefer
> it if they left the naming convention alone... To me the (hd*) translates 
> to including the 0 in the numbering schema... 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.

>> 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)

  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.


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.


Hope I didn't miss anything out.

Regards,
Goh Lip









More information about the kubuntu-users mailing list