Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2013, 05:41 AM
GeoffShep GeoffShep is offline
Senior Member
 
Join Date: Jan 2013
Posts: 179
Thanks: 14
Thanked 50 Times in 41 Posts
Default Dual Boot - Grub 2 with Debian Linux
As a prelude .. the instructions for Grub 2 on the Wiki are incorrect. I have just gone through the pain of configuring a dual boot using Grub2 for PC-BSD 9.1. FWIW, here is my experience. (I've written this in the discussion on the wiki)

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 (the alternative works too). 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. (ie the root partition of your Debian install)
  • 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.


Hope this helps someone stay sane.


Rgds


PS ...
Practical Example

This thread is a practical example of how:
* The installer puts the boot record on the disk it is installed to (even if this is disk 2)
* Grub2 can easily be configured to boot PC-BSD on, say, Disk 3

http://forums.pcbsd.org/showthread.php?t=19441

Last edited by GeoffShep; 02-27-2013 at 04:51 AM. Reason: clarification of meaning of "root partition" + practical example
Reply With Quote
The Following 3 Users Say Thank You to GeoffShep For This Useful Post:
anika200 (09-30-2013), Micros (10-29-2013), Tiberius Duval (02-15-2013)
  #2  
Old 02-15-2013, 01:50 PM
Tiberius Duval Tiberius Duval is offline
Senior Member
 
Join Date: Apr 2012
Location: Turku
Posts: 428
Thanks: 60
Thanked 72 Times in 62 Posts
Default
Geoff's configuration also works with other debian related linux'es, tested with Ubuntu 10.04, 12.04, and Mint 13.
Reply With Quote
  #3  
Old 02-17-2014, 09:15 AM
cabpa cabpa is offline
Senior Member
 
Join Date: Feb 2012
Posts: 668
Thanks: 40
Thanked 7 Times in 7 Posts
Default
Originally Posted by GeoffShep View Post
As a prelude .. the instructions for Grub 2 on the Wiki are incorrect. I have just gone through the pain of configuring a dual boot using Grub2 for PC-BSD 9.1. FWIW, here is my experience. (I've written this in the discussion on the wiki)

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 (the alternative works too). 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. (ie the root partition of your Debian install)
  • 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.


Hope this helps someone stay sane.


Rgds


PS ...
Practical Example

This thread is a practical example of how:
* The installer puts the boot record on the disk it is installed to (even if this is disk 2)
* Grub2 can easily be configured to boot PC-BSD on, say, Disk 3

http://forums.pcbsd.org/showthread.php?t=19441
GeoffShep,

Can your steps in debian grub2 be also automated on PC-BSD's grub2 installer? grub2 in PC-BSD 10 did not detect my Linux installation also
Reply With Quote
  #4  
Old 02-24-2014, 09:36 PM
GeoffShep GeoffShep is offline
Senior Member
 
Join Date: Jan 2013
Posts: 179
Thanks: 14
Thanked 50 Times in 41 Posts
Default
Sorry, I haven't looked at Grub in PC-BSD ... not sure I'm going to get the time for a bit either ....

Rgds
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:13 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.