Cannot add FreeBSD entry to grub 2

Kamil Paral kparal at redhat.com
Wed Apr 11 08:33:38 UTC 2012


> Dear folks,
> 
> I have succeded in installing Fedora 17 nightly build.  I have
> successfully added the updates as of yesterday and today.  I cannot
> add FreeBSD entry to the grub2 configuration.  I have read several
> howto's but only Fedora and two entries for windows show up:
> 
> [root at acer-aspire-1 grub.d]# cat 40_custom
> #!/bin/sh
> exec tail -n +3 $0
> # This file provides an easy way to add custom menu entries.  Simply
> type the
> # menu entries you want to add after this comment.  Be careful not to
> change
> # the 'exec tail' line above.
> menentry "FreeBSD 9.0" {
> 	insmod part_msdos
> 	set root='(hd0,msdos3)'
> 	chainloader +1
> }
> 
> [root at acer-aspire-1 grub.d]# grep menuentry /boot/grub2/grub.cfg
> if [ x"${feature_menuentry_id}" = xy ]; then
>   menuentry_id_option="--id"
>   menuentry_id_option=""
> export menuentry_id_option
> menuentry 'Fedora Linux' --class fedora --class gnu-linux --class gnu
> --class os $menuentry_id_option
> 'gnulinux-simple-252c5a55-c4ed-43d2-b24c-b1c94385a4fc' {
> submenu 'Advanced options for Fedora Linux' $menuentry_id_option
> 'gnulinux-advanced-252c5a55-c4ed-43d2-b24c-b1c94385a4fc' {
> 	menuentry 'Fedora Linux, with Linux 3.3.1-3.fc17.i686' --class
> 	fedora --class gnu-linux --class gnu --class os
> 	$menuentry_id_option
> 	'gnulinux-3.3.1-3.fc17.i686-advanced-252c5a55-c4ed-43d2-b24c-b1c94385a4fc'
> 	{
> 	menuentry 'Fedora Linux, with Linux 3.3.1-3.fc17.i686 (recovery
> 	mode)' --class fedora --class gnu-linux --class gnu --class os
> 	$menuentry_id_option
> 	'gnulinux-3.3.1-3.fc17.i686-recovery-252c5a55-c4ed-43d2-b24c-b1c94385a4fc'
> 	{
> 	menuentry 'Fedora Linux, with Linux 3.3.0-1.fc17.i686' --class
> 	fedora --class gnu-linux --class gnu --class os
> 	$menuentry_id_option
> 	'gnulinux-3.3.0-1.fc17.i686-advanced-252c5a55-c4ed-43d2-b24c-b1c94385a4fc'
> 	{
> 	menuentry 'Fedora Linux, with Linux 3.3.0-1.fc17.i686 (recovery
> 	mode)' --class fedora --class gnu-linux --class gnu --class os
> 	$menuentry_id_option
> 	'gnulinux-3.3.0-1.fc17.i686-recovery-252c5a55-c4ed-43d2-b24c-b1c94385a4fc'
> 	{
> menuentry 'Windows Recovery Environment (loader) (on /dev/sda1)'
> --class windows --class os $menuentry_id_option
> 'osprober-chain-FC8CF1D08CF18584' {
> menuentry 'Microsoft Windows XP Home Edition (on /dev/sda2)' --class
> windows --class os $menuentry_id_option
> 'osprober-chain-5E9AC1839AC15863' {
> 
> 
> I have read that adding FreeBSD entry to 40_custom in /etc/grub.d/
> and running ./40_custom will add the entry to grub.cfg, but it does
> not do it, it appears to be in /etc/grub.cfg, but the entry is not
> there :(

/etc/grub2.cfg should be a symlink to /boot/grub2/grub.cfg

You should really add your custom menuentry to /etc/grub.d/40_custom (careful, you have typo in your "menuentry" keyword). Then you should run:

# grub2-mkconfig -o /boot/grub2/grub.cfg

and it should appear in /boot/grub2/grub.cfg.

It works in my case.

> 
> I can boot FreeBSD by typing c at the menu, and
> 
> grub>	set root='(hd0,msdos3)'
> grub>	chainloader +1
> grub>   boot
> 
> and it would work, but I would prefer to have the entry and avoid
> doing this every time.  I have run
> # grub2-mkconfig -o /boot/grub2/grub.cfg
> 
> It does nothing to add the entry.  I have looked here:
> http://fedoraproject.org/wiki/GRUB_2
> 
> but am at the same place.  I also want to remove rhgb and quiet from
> the grub entry, I did it manually in /boot/grub2/grub.cfg but
> running the command above restored it back :(

Edit /etc/default/grub first.


More information about the test mailing list