Run OpenBSD from USB on MacBook Pro
I own a MacBook Pro (5,5 with Core 2 Duo) and wish to test running OpenBSD on it. But I don’t want any impact on my OS X installation. So I’m going to install and run OpenBSD from a USB stick.
What I used
- A mid-2009 MacBook Pro (MacBookPro5,5);
- A Corsair VoyagerGT 16GB;
- An OpenBSD 5.0 (/snapshots/) CD;
- The rEFIt 0.14 boot selector.
Prepare the USB stick
From what I understood, you cannot simply boot non-OS X OSes on the Mac. You’ll need a special boot loader software. People booting Windows on the MacBook are crazy use Boot Camp. People booting other OSes use Boot Camp or rEFIt. I used the latter because I read Boot Camp was very Windows-only friendly.
The USB stick has to have a dedicated partition that the MacBook will boot on. The boot loader will be installed on it and will deal with the rest:
- Insert the USB stick in the MacBook;
- In Mac OS X, run the
- Partition the USB stick with 2 partitions and a
GUID partition table:
- a (small) HFS+ partition (to host rEFIt);
- a ExFAT partition (to host OpenBSD);
Grab, burn and boot the install50.iso (amd64). On MacBook’s start, press
alt” until the boot selector appears and select the CD/DVD. It’s written
“Windows” in the menu but it is not. Install OpenBSD the usual way on the USB
stick overriding the ExFAT partition.
In the “
fdisk” process, edit the “NTFS” partition and set an
In the “
disklabel” process, select the
"(C)ustom layout" option and
configure root&swap. I kept “i” et “j” as “unknown” slices.
When the install is complete, reboot to Mac OS X.
Install the boot loader
Download rEFIt for Mac .
Mount the rEFIt dmg image and copy the “
efi” directory to USB HFS+ partition.
Then enable it from the
# cd /Volumes/rEFIt/efi/refit # sh enable.sh + sudo bless --folder '/Volumes/rEFIt/efi/refit' --file '/Volumes/rEFIt/efi/refit/refit.efi' --labelfile '/Volumes/rEFIt/efi/refit/refit.vollabel'
I also copied/pasted the
icons/os_openbsd.icns picture on the rEFIt volume
icon. The icon will appear in the boot selection menu.
Reboot the Mac and press “alt” until the boot loader appears.
On reboot, select rEFIt and OpenBSD. That’s the theory. In my configuration, OpenBSD didn’t start. I got the following message from rEFIt:
(...) Error: Not Found from LocateDevicePath Error: Load Error while (re)opening our installation volume The firmware refused to boot from the selected volume. Note that external hard drives are not well-supported by Apple's firmware for legacy OS booting.
I couldn’t found how to solve this properly. Apparently, it seems it would work if I did the install on the internal disk ; but I don’t want to mess it. The solution I used was booting from the CD again and force the bootloader to use the USB stick:
boot> set device hd2a boot> set image /bsd boot> boot booting hd2a:/bsd: 5640200(...)
Then I could get into OpenBSD!
OpenBSD on the MacBook boots fine:
OpenBSD 5.0 (GENERIC.MP) #63: Wed Aug 17 10:14:30 MDT 2011 email@example.com:/usr/src/sys/arch/amd64/compile/GENERIC.MP RTC BIOS diagnostic error b5<clock_battery,config_unit,memory_size,invalid_time> real mem = 8294412288 (7910MB) avail mem = 8059494400 (7686MB) mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0000 (42 entries) bios0: vendor Apple Inc. version "MBP55.88Z.00AC.B03.0906151708" date 06/15/09 bios0: Apple Inc. MacBookPro5,5
The full dmesg output is available here . It runs quite well although I’m running it from USB.
Console and keyboard: ok
My French keyboard, using the ‘fr’ layout has strange key alignement. Kind of same weird distribution when I ran OS X on Dell laptops. Here’s a few “where that damm key is” reminder:
@ is (right)
# is (right)
| is (right)
In fact, the keys are mostly located in their PC keyboard expected location. Think of right
alt key as
AltGr, close your eyes, and the keys are where you expect them…
The more/less brightness keys didn’t work.
Backlit keyboard: nok
There’s no light from the keyboard by default. And I didn’t found a option to activate it. In this configuration, the MacBook looks like all those poor PC configuration… I knew I liked that feature. Now I know I just can’t leave without it.
Energy saving: ok
Speedstep works out of the box. Using
apmd -C, you can tell OpenBSD to lower the CPU speed and keep the MacBook quiet. I used it for an hour or so and I didn’t hear the fan whistling.
hw.sensors.cpu0.temp0=61.00 degC hw.sensors.cpu1.temp0=61.00 degC hw.sensors.acpiac0.indicator0=Off (power supply) hw.sensors.acpibat0.volt0=10.95 VDC (voltage) hw.sensors.acpibat0.volt1=12.52 VDC (current voltage) hw.sensors.acpibat0.watthour0=45.82 Wh (last full capacity) hw.sensors.acpibat0.watthour1=0.25 Wh (warning capacity) hw.sensors.acpibat0.watthour2=0.10 Wh (low capacity) hw.sensors.acpibat0.watthour3=46.98 Wh (remaining capacity), OK hw.sensors.acpibat0.raw0=1 (battery full), OK hw.sensors.acpibat0.raw1=0 (rate) hw.cpuspeed=798 hw.setperf=0
LAN: ok, WLAN: nok
The Gigabit NIC is recognized since the install process and works like a charm. But the wireless interface, a Broadcom BCM4322, does not seem to be useable by OpenBSD. I installed every non-free firmwares but this doesn’t solve the issue.
X-Window: ok (AMAP)
Xorg starts and works out of the box, providing you with a 1280×800 desktop.
I’m not sure if DRI works or not… The Xorg log says:
[564167.591] (II) AIGLX: Screen 0 is not DRI2 capable [564167.591] (II) AIGLX: Screen 0 is not DRI capable [564167.604] (II) AIGLX: Loaded and initialized /usr/X11R6/lib/modules/dri/swrast_dri.so [564167.604] (II) GLX: Initialized DRISWRAST GL provider for screen 0
name of display: :0.0 display: :0 screen: 0 direct rendering: Yes server glx vendor string: SGI server glx version string: 1.4
I ran Firefox 5 in WindowMaker and it behaved as I was used to (in my young times…)
glxgears renders about 28 FPS and Mplayer was lagging when displaying online
The touchpad kind of works. Dragging the mouse is ok, clicking things with the (hidden) button works but click&drag doesn’t. I used a 3-buttons USB mouse to manouver Xorg.
Sound does not work. Or at least I didn’t get how to have it working. I tried
Mplayer with various audio and video files but didn’t get a beep ; neither from internal speakers nor from headphones.
mixerctl output is available here
I won’t use OpenBSD on the MacBook Pro as a workstation right now. If the wireless and sound had been working, I’d have gone further in the experiment. But right now, I’ll remember that this laptop would be a nice server when my actual Dell XPS will die and/or when I’ll buy another MacBook (Pro|Air).
That’s All Folks!