Difference between revisions of "Talk:Dual Booting"

From PC-BSD Wiki
Jump to: navigation, search
(Grub 2: new section)
(Grub 2)
Line 21: Line 21:
 
chainloader +1<br />
 
chainloader +1<br />
 
}</code><br />
 
}</code><br />
 +
 +
 +
------------------------------------------
 +
I have just gone through the pain of configuring a dual boot using Grub2 for PC-BSD 9.1.  FWIW, here is my experience.
 +
 +
'''Computer HDD Setup'''
 +
 +
I have Debian Linux (wheezy) on the first primary partition, with PC-BSD on the second primary partition using the zfs filesystem.  When I installed PC-BSD, I installed its bootloader which overwrote Grub2 on the MBR.
 +
 +
'''Recovering Debian Grub2'''
 +
 +
To re-install Grub2 on the MBR in a Debian system, the installation cd/dvd have the tools specifically built in.  Google on the Debian Wiki and it directs you to the appropriate section of the Debian installation guide.
 +
 +
    Boot using the Debian Install Disk
 +
    Advanced Options
 +
    Recovery Mode
 +
    You will progress through various screens which are the first part of the Debian Installer - don't worry too much because none of the info will be written to the disk.  Eventually ....
 +
    A screen will present the available partitions - select the one you want to be the root partition.
 +
    Select the menu entry to re-install Grub
 +
 +
 +
'''Manual Menu Entries in Debian Grub2'''
 +
 +
Debian automatically builds the Grub2 config file " /boot/grub/grub.cfg" .  There is no point editing it (and they warn you about this - it is a text file that you can read) because it is over-written the next time grub.cfg is created.  Instead, if you look at the end of the file, you will see that they point you to a customisation file " /etc/grub.d/40_custom " .  Open it in an editor (as superuser) and you can add your manual entries to the bottom.  Save the file and then once again as superuser:
 +
" update-grub "
 +
This will incorporate your custimisations in a new grub.cfg file.
 +
 +
'''Adding PC-BSD to Grub2'''
 +
 +
The entry I eventually found was for me (after piecing things together) was:
 +
 +
menuentry "PC-BSD 9.1" {
 +
set root='(hd0,2)'
 +
chainloader +1
 +
 +
"hd0,2"  -
 +
 +
    0 stands for the first hard disk, because you count your disks from zero.
 +
    2 stands for the second partition because you count your partitions from one.
 +
 +
chainloader +1  allows grub to go to the bootloader for PC-BSD which I installed initially if you remember and which is loaded at the start of the PC-BSD partition.
 +
 +
Finally, to change the timeout and default menu entries, I've written previously about this here:
 +
http://glassfloor.blogspot.com.au/search/label/Grub

Revision as of 21:49, 15 January 2013

The option to install a boot loader during PC-BSD installation is no longer present in the GUI, hence the mods to the discussion around recovering from "accidental use" of that previously available option.


Unsure exactly how/where to fit this in:

boot0cfg

From commandline:

boot0cfg -B ada0

Grub 2

I noticed the section on Grub 2 is a little out of date. The map command is a legacy command. In Grub 2, it was renamed to drivemap. Also, the device names changed slightly in Grub 2: the partitions of the hard drive are counted from 1 instead of 0: so, (hd0,msdos1) is the first partition of the first hard drive.

drivemap isn't actually needed to boot PC-BSD if it's on the second disk, at least for me. My menuentry is something like this:

menuentry "PC-BSD 9.1" {
insmod ufs2
set root=(hd1,msdos1)
chainloader +1
}



I have just gone through the pain of configuring a dual boot using Grub2 for PC-BSD 9.1. FWIW, here is my experience.

Computer HDD Setup

I have Debian Linux (wheezy) on the first primary partition, with PC-BSD on the second primary partition using the zfs filesystem. When I installed PC-BSD, I installed its bootloader which overwrote Grub2 on the MBR.

Recovering Debian Grub2

To re-install Grub2 on the MBR in a Debian system, the installation cd/dvd have the tools specifically built in. Google on the Debian Wiki and it directs you to the appropriate section of the Debian installation guide.

   Boot using the Debian Install Disk
   Advanced Options
   Recovery Mode
   You will progress through various screens which are the first part of the Debian Installer - don't worry too much because none of the info will be written to the disk.  Eventually ....
   A screen will present the available partitions - select the one you want to be the root partition.
   Select the menu entry to re-install Grub


Manual Menu Entries in Debian Grub2

Debian automatically builds the Grub2 config file " /boot/grub/grub.cfg" . There is no point editing it (and they warn you about this - it is a text file that you can read) because it is over-written the next time grub.cfg is created. Instead, if you look at the end of the file, you will see that they point you to a customisation file " /etc/grub.d/40_custom " . Open it in an editor (as superuser) and you can add your manual entries to the bottom. Save the file and then once again as superuser: " update-grub " This will incorporate your custimisations in a new grub.cfg file.

Adding PC-BSD to Grub2

The entry I eventually found was for me (after piecing things together) was:

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

"hd0,2" -

   0 stands for the first hard disk, because you count your disks from zero.
   2 stands for the second partition because you count your partitions from one.
chainloader +1  allows grub to go to the bootloader for PC-BSD which I installed initially if you remember and which is loaded at the start of the PC-BSD partition.

Finally, to change the timeout and default menu entries, I've written previously about this here: http://glassfloor.blogspot.com.au/search/label/Grub