Miscellaneous Operating Systems/Hardware

Need help dual-booting Ubuntu and PC-BSD

Actually my current desktop successfully dual-boots with Windows 7 and Ubuntu 12.04. But now I want to add a 3rd OS, PC-BSD (10.1.2), and that thing is giving me a lot of lip.

For background, Each OS is on a separate hard drive (I have 5 hard drives - 1TB with Ubuntu, 1TB with Windows 7, 2TB for Linux storage, 2TB for Windows storage, and now a 3TB drive split for PC-BSD and more Linux storage). The motherboard is running in legacy BIOS mode (I'm almost positive that is still the case).

My first attempts were stopped dead by the partitioning. I made 2 GPT partitions on the 3TB drive, the first around 750 gigs and the second 2TB (Ext4 and labelled). When I would try to install PC-BSD on that drive using the 1st partition it would always fail right at the end, complaining about swap.eli portion. At some point, just to try something different, I reformatted the hard drive so that the 2TB partition showed up first and then the 750 gig partition came after. Again, I chose that 750 gig partition to install PC-BSD. Success!

But, actually, not successful. When I restarted my PC I went into Ubuntu in order to update Grub. But first I decided to mount my new 2TB storage partition. I couldn't find it! What? It's even labelled! Ok, GParted showed me that PC-BSD had for whatever reason inhaled the whole 3TB drive. It installed in the second partition but it had also taken the first 2TB partition and put a tiny bit of something in it. I remembered reading that FreeBSD required a number of slices for an install, the first of which was a freebsd-boot slice of 512k. Ok, I reformatted again , but this time I made 3 partitions, the first was 1 meg, the second was about 750 gigs and the third was the rest (just over 2TB). I put the PC-BSD DVD back in the drive and installed yet again. Success (again)!

I restarted, back in Ubuntu, and GParted confirmed that PC-BSD grabbed the first 2 partitions (even though no documentation I could find says that would happen, everything I read said it would be happy with one partition) and left the third 2TB partition alone. I mounted the new storage partition with no problem. Ok, now for Grub. All the advice I found (including in the handbook) said that it would be simple matter of adding a few lines in the 40_custom file in /etc/grub.d/ and all would be fine, a typical example -

menuentry "PC-BSD 9.1" {
set root='(hd0,2)'
chainloader +1
}

I tried that, ran update-grub , Grub laughed at me, said it couldn't find that partition when I chose the new entry after a restart. I tried hd2,1 and hd2,2 (the 3TB drive is the 3rd drive out of 5) but no joy. More Googling, I find the handbook for PC-BSD 9.1, that one is way more informative. It stated that ZFS partitions are handled differently (PC-BSD automatically formats as ZFS) and so therefore the 40_custom entry should look more like this (from the handbook) -

If you installed ZFS, several modules need to be loaded. Here is a sample entry with the GPT box checked:

menuentry "PC-BSDĀ® 9.1" {

insmod zfs
search -s -l tank0
kfreebsd /freebsd@/boot/kernel/kernel
kfreebsd_module_elf /freebsd@/boot/kernel/opensolaris.ko
kfreebsd_module_elf /freebsd@/boot/kernel/zfs.ko
kfreebsd_module /freebsd@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
set kFreeBSD.vfs.root.mountfrom=zfs:tank0/freebsd
}

Ok, I do that, run update-grub again, restart, choose PC-BSD, fail. At least now it finds that partition but it complains about errors and doesn't know what tank0 is and can't load ELF, must load the kernel first.

More Googling, I find an Italian forum that has a guy with the same issue, he said he booted directly into PC-BSD, copied the info from BSD's grub file (in /boot/grub/grub.cfg ) and put that into his Linux 40_custom file and it worked. Ok, give that a try. I switch hard drive boot order in BIOS, restart, PC-BSD fires up. So at least I know that the install actually succeeded. I go through the first time stuff (set timezone, create passwords and user accounts, etc.) and log in. My PC-BSD version of that grub entry is gigantic but I copy and paste a couple menuentries (normal and single user) and email them to myself. Restart, change boot order back to the Ubuntu hard drive, log in, change 40_custom with the new version of the menuentry for the 2 choices. Looks good, run update-grub , I restart, pick the normal PC-BSD option.

Dick. It still has the same complaints (errors, doesn't know what tank is, can't load ELF, a bunch of must load kernel first lines). I'm not sure what to do now. PC-BSD exists and I can log into it so there's no error on that end. But no amount of begging will get Ubuntu's Grub to play nice and switch over to PC-BSD. Can somebody with more experience with this help me out? If there's a different way to partition and/or install PC-BSD that will make it work with Ubuntu's Grub, I'm all ears. I suspect that maybe the Grub in Ubuntu 12.04 might be too old and it doesn't recognize some aspect of what PC-BSD is doing but that doesn't seem right based on the errors, they tell me that it got far enough to try loading but failed. Yet booting directly into that 3TB hard drive will get me straight into PC-BSD so obviously that version of Grub is fine. Could it be that Ubuntu was installed on a hard drive that was partitioned as MBR (4 total primary partitions allowed, the old standard)? I can find nothing online that says that a Grub bootloader on an MBR partition can't deal with something on a GPT partition (I do plan to reformat the drive to GPT when I update to Ubuntu 14.04 or something else). Then again, the 10.1.2 PC-BSD handbook didn't even mention insmod and kfreebsd_module aspects of the 40_custom entry that seem to be required. Is there some active PC-BSD help desk or email that will give me a quick response answer? Help me Obi Wan Kenobi, you're my only hope!