# [MacBook Pro] OS X Lion / FreeBSD Dual-Boot Setup



## Cinolt (Dec 29, 2011)

My objective is simple: I want to set up a dual-boot system on my MacBook Pro laptop with the existing OS X v10.7 "Lion" and FreeBSD 9.0-RC3.

The internal harddrive stores approximately 500GB. Using OS X Lion, I was able to resize the main partition to 166GB using the GUI Disk Utility program, and I plan for the rest to be used by FreeBSD.

I followed the Handbook for Installing FreeBSD 9.x and Later, assuming that it will work because the processor (I think) is AMD64-compatible and reading of people who have had success in the past.

Specifically, I burned the FreeBSD 9.0-RC3 ISO into a CD-R, restarted the MacBook, then booted into the CD-R with the Startup Manager.

I installed as usual, choosing not to have FreeBSD use the entire disk, but within a Partition(s?). Apparently the internal harddrive is GPT, with 3 existing partitions. Not modifying them, I added the freebsd-boot, freebsd-ufs, and freebsd-swap partitions, after which installation proceeded smoothly (I think) and eventually into the chroot'ed shell, which seemed to work smoothly.

The problem is that I can't boot into the new FreeBSD, as it simply does not show up in the Startup Manager. Yes, I have tried rEFIt, and although it recognizes that something's been installed, when I select it, it outputs a system console message "Missing Operating System" and becomes unresponsive. I'm not sure what the following shell output on the OS X may mean:

```
foo:~ foo$ ls /dev/disk*
/dev/disk0	/dev/disk0s2	/dev/disk0s4	/dev/disk0s6
/dev/disk0s1	/dev/disk0s3	/dev/disk0s5
foo:~ foo$ sudo fdisk /dev/disk0
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  976773167] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused
```
This is not the same as when I did it when I first started, the fdisk output looked more like the one mentioned in the Apple MacBook wiki entry... but I can still boot OS X Lion fine. The wiki entry is vague in it's instructions and may not even be relevant today... I was hoping somebody that has had success doing this could provide more lucid, relevant, and easy to understand advice on how they got it to work.

Thanks for any help.


----------



## T-Daemon (Dec 29, 2011)

You may need to fix the partition table. rEFIt's menu has  a "partition tool". It can synchronize the partition table. If it's unable to proceed, try GPT fdisk.

Here's some reading: What's a GPT?, Hybrid MBRs, Repairing GPT Disks. Other useful tool: rEFIt comes with "Partition Inspector" inside the .dmg image. 
It gives a detailed report of the current partition table. 

PS: First of all, if you haven't done it already, *backup your data!*


----------



## Cinolt (Dec 29, 2011)

Okay, with rEFIT's Partitioning Tool I was able to get sensible output with fdisk.

I still can't get rid of the "Missing Operating System" error however.


----------



## Cinolt (Dec 29, 2011)

Okay, it was complicated, but I finally got it to work.

I am certain that the bsdinstall is bugged, even on FreeBSD 9.0-RC3. Entering in values for the size of freebsd-boot can sometimes come up with negative values.

However I can set the partitions manually with gpart, which I did and it worked. The EXAMPLE section manual page for gpart in this case was particularly helpful. I don't even think I need rEFIt for this, but I'm using it just to be 100% safe.

If anybody needs help with this particular setup, I totally know how you feel and feel free to PM me or anything.


----------



## ddaley (Dec 31, 2011)

I spent some time trying to get an older MacBook (white... non-Pro circa 2007) to dual boot Lion and FreeBSD.  I gave up for now since I decided to run it on some dedicated hardware.  But, I also have a new MacBook Pro (provided by my work).  I decided to run FreeBSD in VMware Fusion.  I have to say, it runs great inside a VM.  At work, I connect the MacBook to two external monitors and run FreeBSD full screen on one monitor and OSX on the other (plus on the MacBook display).  It is a very nice setup.  

Another nice feature about running in an  VM is that you can easily copy your VM prior to doing any upgrades in case something goes wrong.


----------



## ddaley (Dec 31, 2011)

Cinolt,

If you can provide some guidance on dual booting FreeBSD and Lion, I may give that a shot again on my old MacBook.  I did play with this some, but wasn't using gpart.  I was trying to manually fix the partition information, which was a pain.


----------



## Cinolt (Jan 1, 2012)

Hi ddaley. I posted that I got it to work immediately after I was able to boot FreeBSD without the CD. However, what followed after wasn't so great.

I'm not sure what the case is with a VM, but in my particular case with dual-booting there were several issues regarding driver support. First off, I could not get sound nor wireless internet to function whatsoever (though I could get Ethernet working).

Regarding sound, "cat /dev/urandom > /dev/dsp" did not play anything, even though pciconf(8) seemed to have recognized the internal sound card correctly. I'm not sure where to start to fix this issue.

Regarding wireless internet, I believe the new MacBook Pros use a relatively new chip that is currently not supported in the bwi(4) or bwn(4) drivers.

Also the asmc(4) driver mentioned here was simply unsupported, with dmesg(8) mentioning that it simply could not recognize the chipset (or something resembling that).

I have concluded that, in my case, now is not a good time to try and dual-boot FreeBSD on this fairly new hardware, and that simply waiting for future releases with more updated drivers would be the best option.

If you still want to try it though, I recommend reading the gpart(8) manpage. After booting into the FreeBSD install CD, enter a shell and set up the partitions manually with it. Afterwards, when you reboot, I recommend using rEFIt's Partitioning Tool to sync the MBR and GPT tables (?), which I guess is required. From then on, rEFIt will display a second option to boot FreeBSD, and from there you will at least be able to boot into it without the CD.

I'm not an expert by any means on this topic, I'm just posting my experience, so feel free to correct me on any inaccuracies...


----------



## ddaley (Jan 2, 2012)

It might be worth trying FreeBSD in a VM.  I installed Virtual Box, but haven't really tried that, since I have VMware Fusion.  FreeBSD performs great in the VM.  If you run Fusion, be sure to install their tools if you plan to run X11.

I only had one issue where the VM would reboot at random times.  It turns out that there is some issue with the CD driver.  In the VM settings, tell it to "remove" the CD driver and the reboots are gone.  I wouldn't bother doing that unless you actually experience the issue.

I have actually been running FreeBSD in a VM at work doing java development.  So, this hasn't been just a curiosity thing where I installed it in a VM but don't really use it.

As I mentioned above, there are several nice advantages to running in a VM:
1) You can easily back up the entire VM (or move it to another machine)
2) You still have access to OSX and if you have external monitors, you can run FreeBSD full screen on it's own monitor
3) Performance is great (once you get the system installed).  Fusion kinda took over my machine during the install.
4) Hardware is virtualized, so drivers are less of an issue.

Of course, I am not sure if the vmware tools are compatible with FreeBSD 9 yet.


----------



## Cinolt (Jan 3, 2012)

Ah, using a VM went a lot smoother than I thought it would. It was a _lot_ easier than dual-booting, take my word for that.

Point 4) about hardware virtualization is definitely a benefit with the VM method; I got sound and wireless internet working perfectly.. I originally thought this type of emulation would result in very slow operation, but to my surprise it was much faster than I could have asked for.

To anybody reading this relatively recently, learn from my mistake and don't try dual-booting, use a VM.


----------



## irkkaaja (Feb 7, 2012)

I'm still getting "Missing Operating System". This is what the Partition Inspector on rEFIt tells me:


```
*** Report for internal hard disk ***

Current GPT partition table:
 #      Start LBA      End LBA  Type
 1             40       409639  EFI System (FAT)
 2         409640    400070351  Mac OS X HFS+
 3      400070352    401339887  Mac OS X Boot
 4      401339888    401340015  FreeBSD Boot
 5      401340016    443283055  FreeBSD UFS
 6      443283056    449574511  FreeBSD Swap

Current MBR partition table:
 # A    Start LBA      End LBA  Type
 1              1       409639  ee  EFI Protective
 2 *       409640    400070351  af  Mac OS X HFS+
 3      400070352    401339887  ab  Mac OS X Boot
 4      401339888    401340015  a5  FreeBSD

MBR contents:
 Boot Code: Unknown, but bootable

Partition at LBA 40:
 Boot Code: None (Non-system disk message)
 File System: FAT32
 Listed in GPT as partition 1, type EFI System (FAT)

Partition at LBA 409640:
 Boot Code: None
 File System: HFS Extended (HFS+)
 Listed in GPT as partition 2, type Mac OS X HFS+
 Listed in MBR as partition 2, type af  Mac OS X HFS+, active

Partition at LBA 400070352:
 Boot Code: None
 File System: HFS Extended (HFS+)
 Listed in GPT as partition 3, type Mac OS X Boot
 Listed in MBR as partition 3, type ab  Mac OS X Boot

Partition at LBA 401339888:
 Boot Code: None
 File System: Unknown
 Listed in GPT as partition 4, type FreeBSD Boot
 Listed in MBR as partition 4, type a5  FreeBSD

Partition at LBA 401340016:
 Boot Code: None
 File System: Unknown
 Listed in GPT as partition 5, type FreeBSD UFS

Partition at LBA 443283056:
 Boot Code: None
 File System: Unknown
 Listed in GPT as partition 6, type FreeBSD Swap"]
```

I can't make head or tail of this, because it looks just fine to me, but it doesn't boot.

Also: *Cinolt* mentioned wireless problems. I am not sure what wifi card is in this MBP, and I'm not sure how to find out. How do I learn what card I have, so I can know what supports it?


----------



## pr0de (Feb 21, 2012)

Hi,

I've a new iMac since one week, and Lion it is pre-installed. Damned because I don't like this OS! So I decided to install Snow Leopard on my iMac but the problems appears.

Naturally I insert a DVD of SL (10.6.3) in my iMac and I reboot on my DVD to make a clean install. Surprise, it's the Kernel Panic!

Impressed, I research on the web and I (see) it's not possible because the EFi of new Mac with Lion pre-installed is (bridle) by Apple to downgrade the OS.

I think your problems to install reFIT or FreeBSD come from the new EFi of ours Mac with Lion.

But I've maybe a solution for you.

I'm running on Snow Leopard 10.6.8 on my iMac.

To do this, I've installing SL on an external HD in USB with an others Macs in SL (older EFi) if you don't have an other Mac, you can (emulate) this with VMware Fusion but only the 4.1
I've booted on my external HD with SL installed to make the upgrade to SL 10.6.8, I reboot, It's ok.
I plug my external HD on my iMac and I boot on this and surprised it's working.
On my sessions with the external HD, I format my HD on my iMac with disk utilities and I clone all my external HD on my internal HD with the Carbon Copy Cloner.
I go in the system preference to boot on my internal HD I reboot and now I've SL on my iMac, but I've lost the recovery HD of Lion.

Maybe if you proceed approximately this you can install FreeBSD on your Mac.


----------



## dahansen (Mar 23, 2012)

Have run into a similar problem - I am unable to make a Mac Mini i5 boot from a properly installed FreeBSD partition. Unlike you I am not trying to keep Lion; I want only FreeBSD installed, but the problem seems to have the same origin.

Did you find a solution to this?


----------



## shadow (Apr 13, 2012)

Today I installed *Free*BSD 9 on my new MacBook Pro, can't boot also. I tr*ied* many times.
Does any one know how to boot from a BSD partition?


----------



## Nubix (Apr 25, 2012)

*Dual Booting FreeBSD and Mac OS X Lion 7.3*

I have run in the same issue. Dual booting Ubuntu Linux 11.04 on a MacBook Pro early 2011 i5 Intel Processor is easily accomplished with or without rEFIt, the well known boot loader. When I tried to install FreeBSD 9.0, the disk is seen by rEFIt but does not boot. It is as though the boot loader does not recognise a UFS volume. I have tried external drives with a GPT partition totally dedicated to FreeBSD. No joy. I also run FreeBSD 9.0 from an 8GB SanDisk flash drive on an old Samsung NC10 netbook which works beautifully. I think this issue could be related to Mac's EFI. Not absolutely certain. Suggestions or some education would be welcome.


----------



## sevenk (Jan 22, 2014)

Nubix said:
			
		

> on an old Samsung NC10 netbook


*
I find a problem with FreeBSD boot process on my MacBook Pro i5 2012 : after a complete update of the computer : both FreeBSD 9.2 to FreeBSD 10.0, MacOSX Lion to Maverick : I launch FreeBSD on my CDROM and I can't boot, any idea, FreeBSDusers?
*switching to an old notebook PC isn't the solution, i think.


----------



## tzoi516 (Jan 24, 2014)

Boot from a Mac OS X disk and use the `bless` command. There are a few threads on this forum that covers the "how to"


----------



## posthuman01 (Jun 22, 2014)

To get Mac OS X and FreeBSD to both work under rEFIt, you simply need to add the freebsd-boot partition to the GUID that Mac utilizes. https://glenbarber.us/2011/11/12/Dual-Booting-OS-X-and-FreeBSD-9.html These instructions are for FreeBSD 9, but they work fine in 10, haven't tried on 8. Support on my Macbook Air is okay, I've got Gnome, Firefox, Skype, and Python. Sadly no sound, and no wireless. Which brings me to ask, is there a reliable USB wifi device anyone has had luck with?


----------

