# Dualboot FreeBSD / Linux



## thialis (Sep 18, 2011)

Hello,
Last night I installed Ubuntu on a second slice that I have available. Of course I lost the boot of FreeBSD, and impossible to add in Grub2.
I don't know what to do ....
I find no way to get the dual boot FreeBSD / ubuntu ...: (

Can you tell me what are the solutions?


```
thialis@Yunix:~$ sudo fdisk -l
[sudo] password for thialis: 

Disque /dev/sda: 640.1 Go, 640135028736 octets
255 tÃªtes, 63 secteurs/piste, 77825 cylindres
UnitÃ©s = cylindres de 16065 * 512 = 8225280 octets
Taille de secteur (logique / physique)*beep*: 512*beep*octets / 512*beep*octets
taille d'E/S (minimale / optimale)*beep*: 512*beep*octets / 512*beep*octets
Identifiant de disque : 0xa8a8a8a8

PÃ©riphÃ©rique Amorce  DÃ©but        Fin      Blocs     Id  SystÃ¨me
/dev/sda1   *           1       52217   419430280+  a5  FreeBSD
La partition 1 ne se termine pas sur une frontiÃ¨re de cylindre.
/dev/sda2           52217       77826   205701121    5  Etendue
/dev/sda5           52217       52903     5506048   82  Linux swap / Solaris
/dev/sda6           52903       53510     4881408   83  Linux
/dev/sda7           53511       77826   195311616   83  Linux
```


[ do not post in any language other than English - read the forum rules - Mod. ]


----------



## aragon (Sep 18, 2011)

You should be able to add FreeBSD booting to Grub2 if you RTFM...

Otherwise, find a way of getting boot0 installed into your disk's MBR.  You'll need a bootable FreeBSD USB stick, or another FreeBSD system into which you can put your disk.  Use boot0cfg(8).

Of course that might render your linux unbootable.  If it does, you'll need to get Grub installed into your linux's boot partition rather than the disk's MBR...


----------



## shitson (Sep 19, 2011)

Using what Aragon said above + have a look at this article http://www.freebsd.org/doc/handbook/boot-blocks.html


----------



## thialis (Sep 20, 2011)

The problem is that I no longer have access to FreeBSD, I'm stuck on linux (ubuntu) ..
I try many things to add to grub2 FreeBSD but to no avail: (


----------



## zennybsd (Sep 20, 2011)

*upgrade-grub and addd the lines suggested in /boot/grub/grub*

@thialis: If you have access to ubuntu, you may already have a grub2 installed. So from the ubuntu partition, run '[cmd="update grub"]update-grub[/cmd]' which shall detect FreeBSD partition also if you installed grub in mbr.

Else, add the following at the end of the /boot/grub/grub.cfg in the custom section:


```
menuentry 'FreeBSD' --class os {
    set root='(hd0,1)'
    chainloader +1
}
```

Replace necessary parameters like HDD. From what I see from your partition table I feel, the above may work.

But don't forget to backup a copy of the working grub.cfg file because it will get replace once you do the [cmd="upgrade-grub"]upgrade-grub[/cmd] again in the future.

Hope it helps.


*** If any of my posts helped you, please contribute to either http://www.freebsdfoundation.org/donate/ or http://www.thehumanape.org/. Appreciate it! Thanks for your understanding! ***


----------



## shitson (Sep 20, 2011)

thialis said:
			
		

> The problem is that I no longer have access to FreeBSD, I'm stuck on linux (ubuntu) ..
> I try many things to add to grub2 FreeBSD but to no avail: (



Are you unable to load a DVD with FreeBSD on it?


----------



## thialis (Sep 20, 2011)

It's good, Actually it was easy to re-boot with the CD of FreeBSD.
I am now on BSD, what is the best solution for to add Ubuntu to boot?
Install grub on FreeBSD ?


----------



## Beeblebrox (Oct 5, 2011)

FreeBSD's BTX loader is not so good with dual-boot problems. Grub and other dedicated boot-loader software are much better at it - BTX will not be able to boot other O/S so your best bet is grub.

I assume your root on FreeBSD is on UFS, which is solvable with grub, whereas if root is on zfs grub has some problems. If your freeBSD is on UFS, zennybsd gave you the correct answer for your grub menu. Edit your grub.cfg and try it - keeping in mind the correct hdd mapping (hd0 - hd1 - etc) and the correct partition number mapping (gpt2 - gpt3 - etc)

Alternatively, install grub from ports in FreeBSD and run:
`# grub-install`
`# grub-mkconfig`
But I would advise you study the internal commands of grub a little so you can get an idea of how it works. As a plus grub has the ability to boot iso (loopback) files directly...


----------



## Brent87st (Oct 9, 2011)

FreeBSD's BTX loader is not so good with dual-boot problems. Grub and other dedicated boot-loader software are much better at it - BTX will not be able to boot other O/S so your best bet is grub.


----------

