1

My disk partition scheme, as seen by Grub, is as follows:

hd0,gpt1: EFI system
hd0,gpt2: Linux Swap
hd0,gpt3: Linux Filesystem
hd0,gpt4: FreeBSD UFS`

The install process of FreeBSD 11.0-RELEASE went fine, I also tried chrooting and updating the system, just in case. I then booted into Arch Linux and edited /etc/grub/40_custom, trying various configurations (see FreeBSD menu entry in GRUB on wiki.archlinux.org), and ran grub-mkconfig -o /boot/grub/grub.cfg.

(Note: I edited the "mountfrom" parameter specifying the correct dev file for the root fs, which in my case is ada0p4, and omitted the "bsd1" entry, only setting (hd0,gpt4), otherwise it couldn't find the partition.)

If I load kfreebsd /boot/loader and boot, I get a black screen.

If I load

kfreebsd /boot/kernel/kernel 
kfreebsd_loadenv /boot/device.hints
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0p4
set kFreeBSD.vfs.root.mountfrom.options=rw

and boot, I get this:

My laptop is a Thinkpad X220 (stock BIOS up-to-date). Grub version: 2.02.beta3-4.

Any ideas what's wrong here? Please leave a comment if you need further info.

My grub.cfg (link):

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  ff637c2e-1e42-4533-9a12-6ac2f6d43c9b
else
  search --no-floppy --fs-uuid --set=root ff637c2e-1e42-4533-9a12-6ac2f6d43c9b
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ff637c2e-1e42-4533-9a12-6ac2f6d43c9b' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod fat
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  BE35-0EC9
    else
      search --no-floppy --fs-uuid --set=root BE35-0EC9
    fi
    echo    'Loading Linux linux ...'
    linux   /vmlinuz-linux root=UUID=ff637c2e-1e42-4533-9a12-6ac2f6d43c9b rw  
    echo    'Loading initial ramdisk ...'
    initrd  /intel-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-ff637c2e-1e42-4533-9a12-6ac2f6d43c9b' {
    menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-ff637c2e-1e42-4533-9a12-6ac2f6d43c9b' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  BE35-0EC9
        else
          search --no-floppy --fs-uuid --set=root BE35-0EC9
        fi
        echo    'Loading Linux linux ...'
        linux   /vmlinuz-linux root=UUID=ff637c2e-1e42-4533-9a12-6ac2f6d43c9b rw  
        echo    'Loading initial ramdisk ...'
        initrd  /intel-ucode.img /initramfs-linux.img
    }
    menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-ff637c2e-1e42-4533-9a12-6ac2f6d43c9b' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  BE35-0EC9
        else
          search --no-floppy --fs-uuid --set=root BE35-0EC9
        fi
        echo    'Loading Linux linux ...'
        linux   /vmlinuz-linux root=UUID=ff637c2e-1e42-4533-9a12-6ac2f6d43c9b rw  
        echo    'Loading initial ramdisk ...'
        initrd  /intel-ucode.img /initramfs-linux-fallback.img
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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 11.0' {
    insmod ufs2
    set root=(hd0,gpt4)
    kfreebsd /boot/kernel/kernel
    kfreebsd_loadenv /boot/device.hints
    set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0p4
    set kFreeBSD.vfs.root.mountfrom.options=rw
}

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

EDIT: forgot to mention, just before the disk partitioning, I get a warning with the following text

Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?

Since I'm booting with UEFI, i choose not to apply it (I even tried applying it with no success).

  • Have you tried the solutions from this thread (link)? – Mateusz Piotrowski Nov 1 '16 at 19:07
  • 1
    I had already tried; however, I repeated the instructions. I reinstalled grub issuing grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub, then generated the config file adding insmod bsd and --class freebsd --class bsd --class os to my previous configuration. I get the same output as in the picture. Note that my drive is GPT partitioned. Furthermore, os-prober doesn't detect the FreeBSD partition properly, defining it as an "unknown Linux partition". Thank you for formatting my question. – deekin Nov 1 '16 at 19:53
  • 1
    Nope, no luck, same outputs. Tried pretty much everything in that thread and the website you mentioned in your answer there. – deekin Nov 1 '16 at 20:32
  • Did you try chainloading BTX from grub? – John Keates Nov 3 '16 at 2:45
0

I had the same issue on my side with same laptop (lenovo X220 with 2 hard drives, one for system/one for data) and FreeBSD 10. One solution for me was to:

  1. install MBR scheme (GPT support seems broken on this laptop)
  2. install grub
  3. install FreeBSD on some partition

My grub.cfg is simple (and works well for ages):

menuentry 'FreeBSD' {
  insmod bsd
  insmod ufs2
  set root='hd0,msdos3'
  kfreebsd /boot/loader
}

I simply use FreeBSD bootloader to start FreeBSD kernel (with some custom configuration in my loader.conf). If you try to boot directly with kfreebsd option on FreeBSD kernel, you'll have to configure a lot of thing.

BTW, have you read official FreeBSD documentation on multiboot env with grub2?

  • The docs you linked are referring to Grub version 1. If possible, I would avoid converting from GPT to MBR, and find another way around this issue. As a last resort, I'll try and convert. – deekin Nov 2 '16 at 13:07
  • currently, grub2 or grub1 only pass the hand to bootloader, so, configuration change a little but, I think it will work without problem. Concerning GPT over MBR, you can try with this configuration. I haven't tested since long time, perhaps it works now. – Mathieu Kerjouan Nov 2 '16 at 14:34
  • Tried that already, black screen as stated in the question. – deekin Nov 2 '16 at 14:40
  • Could you give FreeBSD version used? – Mathieu Kerjouan Nov 2 '16 at 14:51
0

While most guides suggest to use chainloader +1 for chainloading, it didn't work for me.
The following configuration did the trick:

insmod ufs2  
set root=(hd0,gpt4)  
chainloader /boot/loader.efi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.