LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   GRUB2 can't boot FreeBSD, neither directly nor via the loader (https://www.linuxquestions.org/questions/linux-software-2/grub2-cant-boot-freebsd-neither-directly-nor-via-the-loader-4175447040/)

JZL240I-U 01-24-2013 09:37 AM

GRUB2 can't boot FreeBSD, neither directly nor via the loader
 
Only chainloading works. Here is part of my grub.cfg, first entry (chainloader) works, second (BSD loader) and third (BSD kernel) don't work:

Code:

### BEGIN /etc/grub.d/54_FreeBSD-9.1-chainloader+1 ###
# 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.

menuentry 'FreeBSD 9.1 per Chainloader von /dev/sda3' --class freebsd --class bsd --class os {
# 'osprober-gnulinux-simple-66c11328-0deb-4ccf-a076-289178d8c1a5'
# /dev/sda3 ist /dev/disk/by-uuid/50d5e52c10f44cae ... geht aber so nicht.
    insmod part_msdos
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos3'  50d5e52c10f44cae
          else
            search --no-floppy --fs-uuid --set=root 50d5e52c10f44cae
          fi
    set root='hd0,msdos3'
    set gfxpayload=vga=normal
    chainloader +1
}
### END /etc/grub.d/54_FreeBSD-9.1-chainloader+1 ###

### BEGIN /etc/grub.d/55_FreeBSD-9.1-GRUB2 ###
# 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.

menuentry 'FreeBSD 9.1 via /boot/loader' --class freebsd --class bsd --class os {
    insmod part_msdos
    insmod ufs2
    search --no-floppy --fs-uuid --set=root 50d5e52c10f44cae
    set gfxpayload=vga=normal
    set root=(hd0,msdos3)
    kfreebsd /boot/loader
}
### END /etc/grub.d/55_FreeBSD-9.1-GRUB2 ###

### BEGIN /etc/grub.d/56_FreeBSD-9.1-GRUB2-direkt ###
# 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.

# nach http://forums.freebsd.org/showpost.php?p=56726&postcount=10

menuentry 'FreeBSD 9.1 per kFreeBSD direkt' --class freebsd --class bsd --class os {
    insmod part_msdos
    insmod ufs2
    set gfxpayload=vga=normal
    set root=(hd0,msdos3)
    search --no-floppy --fs-uuid --set=root 50d5e52c10f44cae
    kfreebsd        /boot/kernel/kernel
    kfreebsd_loadenv /boot/device.hints
    set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ad0s3a
    set kFreeBSD.vfs.root.mountfrom.options=rw
}
### END /etc/grub.d/56_FreeBSD-9.1-GRUB2-direkt ###

The second entry produces a "can't load kernel" when selected and stays at the BSD-loader prompt. Trying "load /boot/kernel/kernel" shows no error but issueing a "boot" command just produces a new "can't load kernel"

Selecting the third entry shows some colorful spots on the screen and then reboots after 5 seconds or so. What could be wrong?

amani 01-24-2013 09:56 AM

try insmod bsd

But grub2 is supposed to auto-detect freebsd.
Is grub2 properly installed with all parts?

do it manually to check.

JZL240I-U 01-25-2013 01:40 AM

Quote:

Originally Posted by amani (Post 4876817)
try insmod bsd.

Did that and no joy. I also added "insmod part_bsd", again no change.

Quote:

Originally Posted by amani (Post 4876817)
But grub2 is supposed to auto-detect freebsd. Is grub2 properly installed with all parts?

Yes, it is supposed to auto-detect FreeBSD. But there is a bug, look here https://bugzilla.novell.com/show_bug.cgi?id=759635 and here http://forums.opensuse.org/english/g...ml#post2486361. I installed the supposed bugfix but it did not work either.

So I created the necessary files in /etc/grub.d/ by hand to get the grub.cfg from which I showed a snippet in my first post. Which fails ignominiously.

I suppose GRUB2 is properly installed, it boots uncomplainingly openSuSE 12.2, Ubuntu 12.04, Fedora 17, Mint 14 and chainloads the FreeBSD-loader. Exactly how would I check whether it is properly installed?

amani 01-25-2013 10:38 AM

You can try compiling grub2 first from source
Check grub-mkconfig
remove existing grub
Install

JZL240I-U 01-28-2013 01:26 AM

Well, no, this would be just fishing in muddy waters. As stated in my second post GRUB2 boots 4 Linux distributions and successfully chainloads the FreeBSD-loader. Just direct loading is botched. I suspect a wrong syntax (or parameterizatiion) in the grub.cfg but I have no clue where to set it straight.

JZL240I-U 01-30-2013 04:26 AM

Okay, I found out why it won't work. First, though, I have to amdend this:

Quote:

Originally Posted by JZL240I-U (Post 4877180)
...Yes, it is supposed to auto-detect FreeBSD...

No, it is not GRUB2 which doing the detection, but the "os-prober". It works now correctly after applying the methods from the links I posted earlier. "os-prober" is usually launched during a call to "grub2-mkconfig (-o /boot/grub2/grub.cfg)" (if not disabled).

Launching "grub2-mkconfig" and scanning the output revealed:
Code:

Found FreeBSD on /dev/sda3
      FreeBSD is not yet supported by grub-mkconfig.

So that's why GRUB2 fails to start FreeBSD.

Thanks for your support, amani :).

wu78754 03-02-2013 09:38 PM

Forensic disk recovery
 
Hi JZL240I-U,

Sorry off topic here.
I read you mentioned about "one had to change the values of the bits five to seven times to make it forensically impossible to reconstruct the contents of the disk."
Where did you read that?

JZL240I-U 03-04-2013 02:43 AM

That is not from this thread. When you have questions like these I'd suggest you open your own new thread or mail the member in question (currently me ;)). Anyhow, I don't exactly remember where I read that, but I can offer some links, where you might find more information:

http://www.tolvanen.com/eraser/
http://freshmeat.net/projects/securedelete/
https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase
http://www.linuxquestions.org/questi...4/#post3183940
http://dban.sourceforge.net/
http://freshmeat.net/projects/securedelete/
http://www.linux.com/learn/tutorials...urely-on-linux

HTH. :)


All times are GMT -5. The time now is 09:33 AM.