# Big problem with gpart and dual booting OS X and FreeBSD



## UglyJoe (Aug 18, 2012)

Hey everyone,

I'm completely new to this, and I was trying to get a working dual boot of FreeBSD and OSX on my Macbook. I followed Glen Barber's instructions here. I finished the install and following his directions I used the gpart utility to attempt to modify the FreeBSD boot partition with the command "gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 3 ada0".

I was supposed to get the response "Bootcode written to ada0p3", but instead I got "Bootcode written to ada0" and now I can't boot into anything (I'm using rEFIt, and I get nothing but a white screen when I restart my computer) except using the FreeBSD install disk. I can boot back into the system with this disk and get back to the LiveCD promt, but I don't have a clue how to undo whatever I did with the gpart utility that screwed up the system.

Help!?


----------



## maximini (Aug 18, 2012)

See my thread at http://forums.freebsd.org/showthread.php?t=33297.
I may have tried his instructions. "Bootcode written to ada0p3" is wrong IMO in his tutorial.

To get back OSX, I believe you can either boot from a cloned HD, a rescue OSX CD/DVD, or if you have none of these you need to boot from the Recovery Partition (I have this on my Mini that came with Lion, not sure of yours).  Hold down Command+R during boot to access it.  You should then have access to Disk Utility.  You can then ask it to "Repair" your disk.  Doing so should correct the GPT (GUID partition table) that OSX needs to boot.  When you reboot, all should be fine OSX-wise.  If you have erased the Recovery Partition by mistake with gpart, Command+R at boot time should download what you need from Apple to access Disk Utility.  Search online for this if you need more info.

Cheers,
Maximini


----------



## Beeblebrox (Aug 18, 2012)

> I was supposed to get the response "Bootcode written to ada0p3", but instead I got "Bootcode written to ada0"


Bootcode gets written to HDD's boot-block so the message is correct. You would not write a "bootcode" in a partition if you intend to boot from that HDD.
Personally, for dual-boot systems I prefer grub, and generally disregard any tutorial that mentions other boot managers (or BMs that are not similar). Anything I suggest for the multi-boot will be limited to grub experience. That said: what is the output of:
`# gpart show`


----------



## UglyJoe (Aug 19, 2012)

Thanks guys. I actually just made a bootable rEFIt disk and booted into it, used it's partition tool and it fixed the table and I can dual boot both installs cleanly now. Another questions though... I've read around on these forums that the wireless cards in the Macbooks are difficult to get working with FreeBSD. The documentation clearly says that FreeBSD works with Airport Extreme cards, but when I installed it didn't find the wireless card. SHould I just follow the instructions from http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/config-network-setup.html as much as possible and try and get the card working?

Thanks.


----------

