Help...Dual-booting openSUSE 12.2 and FreeBSD 9.0

Hi all,
I am trying to dual boot openSUSE 12.2 and FreeBSD 9.0, but FreeBSD does not appear in the openSUSE grub2 menu. I have installed ‘gawk’ package (got this idea from the Ubuntu forums). I tried adding the following to 40_custom (got this too from Ubuntu forums), but it didn’t detect FreeBSD:

menuentry “FreeBSD” {
set root=(hd0,1)
chainloader+1
}

My partition setup is as below:

sda1 freebsd-ufs 15GB FreeBSD
sda6 swap 4GB swap
sda7 ext4 15GB Opensuse
sda8 ext4 268GB /home

waiting for your replies. thanks.

After adding a chainloader entry in 40_custom, you have to rewrite the Grub menu with

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

So try that first! If your BSD partition contains a valid bootloader, your chainloader should work.

Otherwise, if you want to detect and boot the FreeBSD kernel with Grub, read my bugreport here: https://bugzilla.novell.com/show_bug.cgi?id=759635 and install os-prober 1.53 from my repo. You can see how to upgrade os-prober with vendor change in this post: http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/478300-boot-options-truncated-foreign-kernels-grub-menu.html#post2486361

You need this version of os-prober to read ufs2 partitions. Here’s an example:

# os-prober
  No volume groups found
/dev/sda1:Windows NT/2000/XP (loader):Windows:chain
/dev/sda11:Linux Mint 12 Lisa (12):LinuxMint:linux
/dev/sda13:Arch Linux (rolling):archlinux:linux
/dev/sda16:Debian GNU/Linux (squeeze/sid):Debian:linux
/dev/sda3:FreeBSD:FreeBSD 8.1-RELEASE:freebsd
/dev/sda6:Ubuntu 12.04.1 LTS (12.04):Ubuntu:linux
/dev/sdb1:Windows NT/2000/XP (loader):Windows1:chain
/dev/sdb6:Mandriva Linux 2010.2 (2010.2):MandrivaLinux:linux

Further, if you want Grub2 to generate boot entries for BSD, you need to add this code to /etc/grub.d/30_os-prober. Saying that, I realize that I should have written a separate script … anyway.

	freebsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class freebsd --class os {
EOF
   	  ufsid=`${grub_probe} --device ${DEVICE} --target=fs_uuid`
      save_default_entry | sed -e "s/^/	/"
	  ${grub_probe} --device ${DEVICE} --target=fs | sed "s|^|	insmod |"
	  ${grub_probe} --device ${DEVICE} --target=drive | sed "s|^\((.*,\)^0-9]*\([0-9]*\))|	set root='\1\2,a)'|"
      cat << EOF
	search --no-floppy --fs-uuid --set=root $ufsid
	kfreebsd /boot/kernel/kernel
	kfreebsd_loadenv /boot/device.hints
	set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$ufsid
	set kFreeBSD.vfs.root.mountfrom.options=rw
}
EOF
    ;;
	netbsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class netbsd --class os {
EOF
      save_default_entry | sed -e "s/^/	/"
	  ${grub_probe} --device ${DEVICE} --target=fs | sed 's|^|	insmod |'
	  ${grub_probe} --device ${DEVICE} --target=drive | sed 's|^|	set root=|p;$s|set root=(hd\([0-9]*\),.*|knetbsd /netbsd --root=wd\1a|'
      cat << EOF
}
EOF
	;;
	openbsd)
      cat << EOF
menuentry "${LABEL} (on ${DEVICE})" --class openbsd --class os {
EOF
      save_default_entry | sed -e "s/^/	/"
	  ${grub_probe} --device ${DEVICE} --target=drive | sed 's|,[a-zA-Z]*|,|;s|^|	set root=|'
      cat << EOF
	chainloader +1
}
EOF
    ;;

But if you have no idea how to edit this script, then don’t!

@ please_try_again,
thank you for your reply. The isssue solved after an update. Now, FreeBSD appears in the grub2 menu but when I select FreeBSD, the following error appears:

Error: cannot find the command chainloader

There was an update of grub2-branding-openSUSE yesterday, and it did rewrite the Grub menu. That’s why you can see the entries you added in 40_custom now. So you were lucky. But next time don’t wait for a Grub or kernel update to refresh your Grub menu (you might wait long). just run:

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

Do you get it? Each time you modify 40_custom, you’ll have to run this command. And you will have to do it pretty soon because …

You’re missing a space after “chainloader”.

It should be:


chainloader +1

@please_try_again
sorry for the late reply. but it didnt work out. gave me the same error. anyway, i am setting aside my plan to install FreeBSD as i just discovered that FreeBSD does not support ext4 partitions. maybe, i’ll try LFS or Gentoo. not yet decided. and thank you for your support.