This post was originally titled "Using GRUB2 to chainload FreeBSD from protective MBR (PMBR)".
I have Windows 8, Arch Linux, and FreeBSD 10.0 all installed on the same disk. All my partitions are in the GPT format (not MBR). I'm able to boot into Windows and Linux, but not FreeBSD.
For FreeBSD, I have 4 partitions: freebsd-boot, freebsd-zfs for /boot, freebsd-swap, freebsd-zfs for /. I installed the bootloader code like so:
I used
When I use
My /etc/grub.d/40_custom on Arch Linux has the following menu entry for FreeBSD, which I added manually:
All the partitions on my disk are using GPT. gpt11 is my FreeBSD root partition, which uses ZFS. gpt2 is my ESP. If I try booting the FreeBSD entry, I see the following GRUB2 error:
If I look at the /boot/sda.mbr file, the strings that I can make out are "EFI" and "PART". I also see "Boot loader too large", "Invalid partition table", "I/O error loading boot loader", and "Missing boot loader". I'm not sure if those are just error strings that are defined for the stage 1 (or 0 or whatever) boot loader, or if those strings indicate that there's something wrong with my MBR.
The reason why I'm trying to chainload my MBR is because I'm unable to boot FreeBSD at all (boot managers don't even list it). I've even installed rEFInd, which is unable to detect FreeBSD on my disk. Since I'm using FreeBSD 10.0, ESP is unsupported, so I cannot boot from ESP. I thought of just waiting for FreeBSD 10.1, which does have ESP support; however, 10.1 won't support ESP where root is on ZFS.
My system has Secure Boot, Quiet Boot, and Fast Startup all disabled. I have CSM enabled, which allows me to boot MBR-based disks. I've booted plenty of MBR-based LiveCDs and LiveUSBs on my machine.
At this point, I suspect two things: either (1) my MBR is corrupt; or (2) my UEFI firmware is unable to boot from MBR when it detects that I'm using GPT. I'm trying to chainload to get around number 2; however, GRUB2 cannot load the MBR image, which makes me suspect that there's a problem with my MBR.
I've already tried using the following GRUB2 options when booting FreeBSD:
The output was not helpful.
Any ideas? I'm stuck on where to go to from here. Is what I'm trying even possible? Maybe my UEFI firmware and GRUB2 and rEFInd see that my MBR is a protective MBR (PMBR) and that I have a GPT-based disk, so they ignore whatever else is in the MBR because they expect to boot GPT from ESP. I also wonder if having Windows, Linux, and FreeBSD all on the same disk is somehow overloading the MBR.
EDIT: The solution is posted in message #21: https://forums.freebsd.org/threads/...d-from-protective-mbr-pmbr.48442/#post-271242.
I have Windows 8, Arch Linux, and FreeBSD 10.0 all installed on the same disk. All my partitions are in the GPT format (not MBR). I'm able to boot into Windows and Linux, but not FreeBSD.
For FreeBSD, I have 4 partitions: freebsd-boot, freebsd-zfs for /boot, freebsd-swap, freebsd-zfs for /. I installed the bootloader code like so:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i <index_of_freebsd-boot_partition> <device>
.I used
dd if=/dev/sda of=/boot/sda.mbr bs=512 count=1
to backup my MBR to my EFI System Partition (ESP), which is mounted at /boot.When I use
file -k /boot/sda.mbr
, I see
Code:
DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,1), end-CHS (0x3ff,254,63), startsector 1, 1953525167 sectors
My /etc/grub.d/40_custom on Arch Linux has the following menu entry for FreeBSD, which I added manually:
Code:
menuentry 'FreeBSD 10.0' {
set root='hd0,gpt11'
chainloader (hd0,gpt2)/sda.mbr
}
All the partitions on my disk are using GPT. gpt11 is my FreeBSD root partition, which uses ZFS. gpt2 is my ESP. If I try booting the FreeBSD entry, I see the following GRUB2 error:
Code:
error: cannot load image.
If I look at the /boot/sda.mbr file, the strings that I can make out are "EFI" and "PART". I also see "Boot loader too large", "Invalid partition table", "I/O error loading boot loader", and "Missing boot loader". I'm not sure if those are just error strings that are defined for the stage 1 (or 0 or whatever) boot loader, or if those strings indicate that there's something wrong with my MBR.
The reason why I'm trying to chainload my MBR is because I'm unable to boot FreeBSD at all (boot managers don't even list it). I've even installed rEFInd, which is unable to detect FreeBSD on my disk. Since I'm using FreeBSD 10.0, ESP is unsupported, so I cannot boot from ESP. I thought of just waiting for FreeBSD 10.1, which does have ESP support; however, 10.1 won't support ESP where root is on ZFS.
My system has Secure Boot, Quiet Boot, and Fast Startup all disabled. I have CSM enabled, which allows me to boot MBR-based disks. I've booted plenty of MBR-based LiveCDs and LiveUSBs on my machine.
At this point, I suspect two things: either (1) my MBR is corrupt; or (2) my UEFI firmware is unable to boot from MBR when it detects that I'm using GPT. I'm trying to chainload to get around number 2; however, GRUB2 cannot load the MBR image, which makes me suspect that there's a problem with my MBR.
I've already tried using the following GRUB2 options when booting FreeBSD:
Code:
set pager=1
set debug=all
The output was not helpful.
Any ideas? I'm stuck on where to go to from here. Is what I'm trying even possible? Maybe my UEFI firmware and GRUB2 and rEFInd see that my MBR is a protective MBR (PMBR) and that I have a GPT-based disk, so they ignore whatever else is in the MBR because they expect to boot GPT from ESP. I also wonder if having Windows, Linux, and FreeBSD all on the same disk is somehow overloading the MBR.
EDIT: The solution is posted in message #21: https://forums.freebsd.org/threads/...d-from-protective-mbr-pmbr.48442/#post-271242.
Last edited: