4

To be clear what I want is a FreeBSD GRUB2 entry that boots FreeBSD on a ZFS (name: zroot) with BIOS firmware (not UEFI). The operating system GRUB is installed on is Arch Linux if it helps, Arch is using a ext4 root, it is FreeBSD that is using ZFS.

My partition table is (GPT):

/dev/sda1 - BIOS boot (1M) 
/dev/sda2 - Linux swap (4G) 
/dev/sda3 - Linux filesystem (ext4, 50G) 
/dev/sda4 - FreeBSD boot (128k) 
/dev/sda5 - FreeBSD ZFS filesystem (74G)

I've seen this answer but it pertains to FreeBSD on a UFS root, and I've also seen this answer which pertains to Arch Linux on ZFS, not FreeBSD on ZFS.

I've tried using this entry:

menuentry "FreeBSD" --class freebsd --class bsd --class os {
    insmod zfs
    insmod bsd
    set root=(hd0,4)
    kfreebsd /boot/kernel/kernel
    kfreebsd_loadenv /boot/device.hints
    set kFreeBSD.vfs.root.mountfrom="zfs:zroot"
    set kFreeBSD.vfs.root.mountfrom.options=rw
    set kFreeBSD.hw.psm.synaptics_support=1
}

but I received this error:

enter image description here

Using FreeBSD's bootloader (which sadly I overrode by installing GRUB to my disk, although it is simple to restore it) I managed to boot my FreeBSD install, so there's nothing wrong with it. I installed FreeBSD and set it up to boot by following what I put in this directory: https://github.com/fusion809/freebsd-scripts/tree/master/zfs-manual-install.

2
  • 1
    If I read your partition table right, you are setting root as hd0,5, but your FreeBSD boot partition is hd0,4. I’m guessing your kernel is on hd0,4.
    – Peschke
    Nov 10, 2018 at 9:11
  • 1
    Good point mate, after adjusting the partition to be booted to 4 I get a little further, but now I get another error, which I'll add to my question.
    – Josh Pinto
    Nov 10, 2018 at 9:44

1 Answer 1

5

Never mind I found the answer thanks to the FreeBSD forums. This is what I needed in my grub.cfg:

menuentry "FreeBSD" --class freebsd --class bsd --class os {
    insmod zfs
    insmod bsd
    search -s -l zroot
    kfreebsd /@/boot/zfsloader
    kfreebsd_loadenv /@/boot/device.hints
}

To be clear I have tried this successfully, I even tried writing a file and rebooting to check it wasn't just read-only and the file was still there and had not been altered by the reboot in any way (not even its permissions were).

2
  • 2
    Be sure to check your answer. You won't get points but this was a good find. +1 vote from me
    – eyoung100
    Nov 11, 2018 at 3:38
  • 1
    I've tried it, I was concerned that maybe omitting the rw line might make things read-only, but I wrote a file rebooted and the file was there and was the same. So from what I can tell it is working perfectly. If you have a specific concern of something I may have overlooked please do tell.
    – Josh Pinto
    Nov 11, 2018 at 3:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .