search

Loading

Saturday, November 29, 2014

How to dual boot Linux (CrunchBang Linux) and PC-BSD 10 with ZFS file system

This is a tutorial which shows how to dual boot Linux and PC-BSD 10. PC-BSD 10 uses ZFS as the file system and grub for the boot manager. I was able to successfully dual boot PC-BSD and CrunchBang Linux in my laptop.

I was able to achieve this after lots of trial and error methods. I have not found a valid guide in the internet to do it. All the tutorials were outdated or at least not working for me. I have spend a lot of time in the pc-bsd/freebsd irc channels and finally able to achieve this after trying out different suggestions from the irc members. Thanks to them all for the guidance.

If you want to dual boot PC-BSD, first install the Linux os (in this case, CrunchBang Linux) and then install PC-BSD 10. This is because most of the Linux OS won't be able to detect ZFS (the default file system in PC-BSD 10). But PC-BSD grub will be able to detect EXT4 the default file system in most of the Linux distros. If you are looking for a tutorial for PC-BSD with UFS and Linux, you can find lot of guides in the interwebs. My guide only applies to PC-BSD with ZFS file system.

1. Install Crunch Bang Linux
2. Copy the relevant part from the Crunch Bang Linux grub menu.  You can get it from the configuration file  /boot/grub/grub.cfg . There will be lot of unwanted details in this menu but we will only need the one starts after the line "### BEGIN /etc/grub.d/10_linux ###" in this file .

For example, below given is the relevant part from my Crunch Bang Linux grub configuration :

menuentry 'CrunchBang GNU/Linux, with Linux 3.2.0-4-amd64' --class crunchbang --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 1fa97d1a-97c2-45ab-ba94-1f692ce86756
    echo    'Loading Linux 3.2.0-4-amd64 ...'
    linux    /boot/vmlinuz-3.2.0-4-amd64 root=UUID=1fa97d1a-97c2-45ab-ba94-1f692ce86756 ro  quiet
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-3.2.0-4-amd64
}


And upload this to online website like http://pastie.org/ and take a note of the link. This is because we need to get this after we install PC-BSD and configuring it's grub

3. Install PC-BSD 10 with ZFS as the file system
4. You won't see any option to boot Crunch Bang Linux after you install PC-BSD
5. Once you boot to PC-BSD, edit the grub configuration for PC-BSD
Open /usr/local/etc/grub.d/40_custom and add the earlier copied Crunch Bang Linux grub configuration to this file so that it will look like this. 


cat /usr/local/etc/grub.d/40_custom


menuentry 'CrunchBang GNU/Linux, with Linux 3.2.0-4-amd64' --class crunchbang --class gnu-linux --class gnu --class os {
       load_video
       insmod gzio
       insmod part_msdos
       insmod ext2
       set root='(hd0,msdos5)'
       search --no-floppy --fs-uuid --set=root 1fa97d1a-97c2-45ab-ba94-1f692ce86756
       echo    'Loading Linux 3.2.0-4-amd64 ...'
       linux   /boot/vmlinuz-3.2.0-4-amd64 root=UUID=1fa97d1a-97c2-45ab-ba94-1f692ce86756 ro  quiet
       echo    'Loading initial ramdisk ...'
       initrd  /boot/initrd.img-3.2.0-4-amd64
}

5. Update the grub configuration in PC-BSD with the below command

grub-mkconfig > /boot/grub/grub.cfg

Then reboot and make sure that grub is showing the above entries.

Some times you need to do “Hold Left-Shift for menu entries” to display all the boot entries.





4 comments :

  1. It would be useful to see what the pc-bsd entry in grub.cfg looks like.

    ReplyDelete
  2. It uses the default grub menu for PC-BSD. So I haven't copied the grub menu entry in PC-BSD grub.cfg file

    ReplyDelete
  3. Hi
    Thanks for the article I found it very helpful. I have a triple boot set up with each OS on a separate disk - OSX, Linux Mint64, PC-BSD10.1.1.
    I tried the set up as you indicated, with copying of the Linux grub entry, but the editing of the 40_custom file in PC-BSD did not work for LinuxMint even after I updated grub as you indicated.
    What did work in PC-BSD was to go PC-BSD Control Panel
    - select the Boot Manager icon under System Management, enter password
    - open the section copied as noted in your article
    - select the Grub Configuration tab on the Bootup Configuration
    - save it, close and re-boot and select the entry on the PC-BSD boot screen
    There may be a bit of clean you you have to do on the Grub entry in the PC-BSD Grub Configuration tab as some lines give errors but it still boots to Linux

    Thanks for your article once again

    ReplyDelete
  4. This tutorials are of great help, it would surely give some more knowledge about linux.

    ReplyDelete