Modifying grub.cfg

Goh Lip g.lip at gmx.com
Thu Mar 25 03:50:44 UTC 2010


On 03/25/2010 11:15 AM, Goh Lip wrote:

> modifying menu entries of the kernels....

[Example 1]

menuentry "Hardy  " {
	configfile (hd0,8)/boot/grub/grub.cfg
}

menuentry "Lucid " {
	configfile (hd0,5)/boot/grub/grub.cfg
}

menuentry "Linuz " {
	linux (hd0,5)/vmlinuz root=/dev/sda5
	initrd (hd0,5)/initrd.img
}


menuentry "Chain " {
	set root=(hd0,2)
	chainloader +1
}

menuentry "Wins7" {
	insmod ntfs
	set root=(hd0,4)
	search --no-floppy --fs-uuid --set 387fab3b1ed0ef51
	chainloader +1
}

The above [Example 1] was a throw back to the time using grub-legacy, 
it'll work but it will boot up the grub menu of the OS and use more time 
at the 2nd grub. I've come to like [Example 2] below where it'll bypass 
the 2nd grub menu.


[Example 2]

menuentry "Hardy " {
	linux (hd0,8)/vmlinuz root=/dev/sda8
	initrd (hd0,8)/initrd.img
}
menuentry "Lucid " {
	linux (hd0,5)/vmlinuz root=/dev/sda5
	initrd (hd0,5)/initrd.img
}
menuentry "Configfile " {
	configfile (hd0,5)/boot/grub/grub.cfg
}


menuentry "Chain " {
	set root=(hd0,2)
	chainloader +1
}

menuentry "Wins7" {
	insmod ntfs
	set root=(hd0,4)
	search --no-floppy --fs-uuid --set 387fab3b1ed0ef51
	chainloader +1
}


Further modifications of example 2
[a] use of root=UUID=xxxxxxxx instead of root=/dev/sdax
[b] adding ro quiet splash to linux line
     'ro' is superfluous; quiet and splash quite nice to have
      vga if necessary
[c] sequence your priorities: nothing will change it unless you
     manually modify it.

Additional notes:

[i]   latest grub version shows root='(hd0,x)' instead of just 
root=(hd0,x). Tested no difference if used with or without single 
quotes. Don't know why it's there or its significance.

[ii]   If there is a new grub version say 1.99 in lucid, at lucid 
terminal, just do again
sudo grub-install --root-directory=/media/Booto /dev/sda
and you'll have the latest grub version at /media/Booto and the grub.cfg 
(of Booto) will remain untouched.


I guess that's all.


Regards - Goh Lip





More information about the ubuntu-users mailing list