- Om oss
- Plattformar och lösningar
- Utvecklingsverktyg och arbetsmetodik
Dual boot Mac OS X and Ubuntu
2013-01-07Publicerad av Sven-Åke Andersson
I got my first Macintosh computer in 1993. SInce then I have been using Mac computers for all my home computing. At work I have always used unix machines. In the beginning it was Sun workstations running Sun OS and later on Linux on X86 machines. For the last 5-6 years it has been possible to install Linux in a virtual machine running on Mac using VirtualBox or VMware Fusion.
Dual boot vs virtual machine
Dual-booting allows the user to set up the machine to run more than one operating system and choose which operating system one wants to run. Typically one would set up dual-booting to run two different operating systems, such as Windows and Mac OSX or Windows and Linux. Typically in dual booting, our disk is partitioned in a way where one partition is for one operating system and another partition is for the other operating system. Our system is now set up to allow us to choose which operating system we would like to run.The selling point of dual-booting is performance. By dual-booting, we get full access to the memory and processor as well as other peripherals (video, network card).
There are numerous software packages that will allow you to set up a virtual machine, which is a software "emulation" of a computer that runs exactly like a physical computer with the operating system running on it. The selling point of virtual machines is convenience. If we are running one operating system but we need instant access to multiple operating systems, we can easily do this with a virtual machine without having to reboot our main machine. If we no longer need to use a particular operating system, all we need to do is delete the virtual machine rather than having to reconfigure our disk partitions and reinstall software.
After running several Linux distributions in virtual machines on my MacBook Pro I am now ready to setup a dual-boot system. It all started when a Mac Mini 2009 model I had used as a media center was replaced with an Apple TV. Why not setup a combined home computing/enginering machine. Let's give it a try. Here is system we will use.
It consists of the following parts:
- Mac Mini 3.1 Late 2009
- Apple aluminium USB keyboard
- Apple Cinema Display 23" DVI connection
- USB mouse
I skipped the bluetooth keyboard and mouse because I don't know if bluetooth will work out of the box. Here is some more information about the system:
Ubuntu 12.10 can be downloaded from here. I chose the 64 bit version. We could also use the 32 bit version.
Burning a DVD
There are two ways we can boot the Linux OS the first time, from a CD/DVD or from a USB-stick. The Mac Mini has a DVD player so will boot from a DVD this time. The downloaded ISO image file (ubuntu-12.10-desktop-amd64.iso) is 800 Mb. It will not fit on a CD so we have to burn it to a DVD. Booting from a USB-stick is a bit more complicated but we will try that method the next time. We will use the Mac Disk Utility program to burn the DVD.
Preparing for dual boot
There are two things we have to do before we can start the installation of Ubuntu Linux.
- Make room on the hard disk for the Linux OS.
- Download and install the rEFIt boot menu.
We will use the Disk Utility program again but this time we select the FUJITSU hard drive and then Partition. Here is the trick. We will not add a new partition only shrink the Macintosh HD partition to make room for the Linux installation. We will let the Ubuntu installer take care of the partitioning of the hard disk. Let's make the Machintosh HD partition 100GB smaller, which will leave 100GB for the Linux part.
rEFIt boot menu
rEFIt is a boot menu and maintenance toolkit for based machines like the Intel Macs. It can be used to boot multiple operating systems, including triple-boot setups with Boot Camp. It also provides a way to enter and explore the EFI pre-boot environment. The name "rEFIt" is likely a play on the terms "refit" and "EFI." It can be downloaded from here.
After downloading and installing the Mac disk image a directory called efi has been added in the same directory where the Application and System directories reside. We are now ready to boot form the DVD.
Booting from DVD
- Start by inserting the DVD with the ISO image in to the DVD player when Mac OS X is running.
- Shutdown the system.
- Start the system and press the c key on the keyboard during startup.
If everything works this screen will be displayed.
We now have two possibilities:
- Try Ubuntu and boot from the live DVD. This will not change anything on our hard disk.
- Install Ubuntu to our hard disk
Let's try Ubuntu and boot from the liv DVD. It will take a bit longer to boot but after a few minutes the familiar Ubuntu start screen will appear. Here is the home directory.
We can use the Partition Tool (GParted) to take a look at the disk partitions. Nothing has changed so far.
Install Ubuntu Linux
We are ready to install Ubuntu Linux. We restart the system and hold down the c-key and this time we select: Install Ubuntu. Here is the first message screen.
We have 100GB of available disk space but we are not connected to Internet. Let's click Continue. Here is the next screen.
We select Install Ubuntu alongside Mac OS X and click Install Now. Can it be this simple. It seems like. After going through the normal setup screens the installation starts and finish after an hour or more.
Booting Ubuntu Linux
When we restart the system the following screen is displayed. Select the Linux Penguin and boot into Ubuntu.
After login the Ubuntu Unity desktop is displayed.
What happened during the installation. Let's find out. We will install gparted and display the new partitions.
sudo apt-get install gparted
There are three new partitions created during the installation process:
When I thought everything was OK I just noticed that we don't have a wireless connection. The upper right corner of the screen looked like this.
I tried to connect without success. It seems we are missing or using the wrong software driver for our wireless network controller. Time for some debugging. I am not a Linux expert so I have to look for a solution on the web. This is the first page I found. Let's find out what hardware we have in our Mac Mini. We use the lspci command to find all hardware connected to the PCI bus.
00:00.0 Host bridge : NVIDIA Corporation MCP79 Host Bridge [10de:0a82] (rev b1)
00:00.1 RAM memory : NVIDIA Corporation MCP79 Memory Controller [10de:0a88] (rev b1)
00:03.0 ISA bridge : NVIDIA Corporation MCP79 LPC Bridge [10de:0aae] (rev b3)
00:03.1 RAM memory : NVIDIA Corporation MCP79 Memory Controller [10de:0aa4] (rev b1)
00:03.2 SMBus [0c05]: NVIDIA Corporation MCP79 SMBus [10de:0aa2] (rev b1)
00:03.3 RAM memory : NVIDIA Corporation MCP79 Memory Controller [10de:0a89] (rev b1)
00:03.4 RAM memory : NVIDIA Corporation Device [10de:0a98] (rev b1)
00:03.5 Co-processor [0b40]: NVIDIA Corporation MCP79 Co-processor [10de:0aa3] (rev b1)
00:04.0 USB controller [0c03]: NVIDIA Corporation MCP79 OHCI USB 1.1 Controller [10de:0aa5] (rev b1)
00:04.1 USB controller [0c03]: NVIDIA Corporation MCP79 EHCI USB 2.0 Controller [10de:0aa6] (rev b1)
00:06.0 USB controller [0c03]: NVIDIA Corporation MCP79 OHCI USB 1.1 Controller [10de:0aa7] (rev b1)
00:06.1 USB controller [0c03]: NVIDIA Corporation MCP79 EHCI USB 2.0 Controller [10de:0aa9] (rev b1)
00:08.0 Audio device : NVIDIA Corporation MCP79 High Definition Audio [10de:0ac0] (rev b1)
00:09.0 PCI bridge : NVIDIA Corporation MCP79 PCI Bridge [10de:0aab] (rev b1)
00:0a.0 Ethernet controller : NVIDIA Corporation MCP79 Ethernet [10de:0ab0] (rev b1)
00:0b.0 IDE interface : NVIDIA Corporation MCP79 SATA Controller [10de:0ab5] (rev b1)
00:10.0 PCI bridge : NVIDIA Corporation MCP79 PCI Express Bridge [10de:0aa0] (rev b1)
00:15.0 PCI bridge : NVIDIA Corporation MCP79 PCI Express Bridge [10de:0ac6] (rev b1)
00:16.0 PCI bridge : NVIDIA Corporation MCP79 PCI Express Bridge [10de:0ac7] (rev b1)
02:00.0 VGA compatible controller : NVIDIA Corporation C79 [GeForce 9400] [10de:0861] (rev b1)
03:00.0 Network controller : Broadcom Corporation BCM4321 802.11a/b/g/n [14e4:4328] (rev 05)
04:00.0 FireWire (IEEE 1394) [0c00]: LSI Corporation FW643 [TrueFire] PCIe 1394b Controller [11c1:5901] (rev 07)
This tells us that the network controller uses the Broadcom BCM4321 chip set. It also tells us that:
- The chip ID is BCM4321
- The PCI-ID is [14e4:4328]
Each chip set has its own software driver/kernel module to interface with the hardware. As we may appreciate, drivers are under constant development and their are differences in availability and support across the different Ubuntu releases. For example, the latest Ubuntu release will have higher versions of the drivers than the last Ubuntu. According to this page the driver we should use is called wl.
Installing the wl driver
First let's find out if we have the wl module installed. We use the command lsmod to list all installed kernel modules:
Module Size Used by
nls_iso8859_1 12713 1
nouveau 895609 3
ttm 83595 1 nouveau
drm_kms_helper 49112 1 nouveau
drm 288670 5 nouveau,ttm,drm_kms_helper
i2c_algo_bit 13413 1 nouveau
mxm_wmi 12979 1 nouveau
video 19335 1 nouveau
wmi 19070 2 nouveau,mxm_wmi
snd_hda_codec_realtek 78045 1
rfcomm 46619 12
parport_pc 32688 0
bnep 18140 2
ppdev 17073 0
coretemp 13400 0
kvm_intel 132759 0
kvm 414070 1 kvm_intel
applesmc 19314 0
input_polldev 13896 1 applesmc
microcode 22803 0
lib80211_crypt_tkip 17379 0
lib80211 14381 2 lib80211_crypt_tkip,wl
shpchp 37108 0
snd_hda_intel 33491 3
snd_hda_codec 134212 2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep 13602 1 snd_hda_codec
snd_pcm 96580 2 snd_hda_intel,snd_hda_codec
snd_seq_midi 13324 0
snd_rawmidi 30512 1 snd_seq_midi
snd_seq_midi_event 14899 1 snd_seq_midi
snd_seq 61521 2 snd_seq_midi,snd_seq_midi_event
snd_timer 29425 2 snd_pcm,snd_seq
btusb 22474 0
snd_seq_device 14497 3 snd_seq_midi,snd_rawmidi,snd_seq
bluetooth 209199 22 rfcomm,bnep,btusb
snd 78734 15 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 15047 1 snd
snd_page_alloc 18484 2 snd_hda_intel,snd_pcm
i2c_nforce2 13013 0
mac_hid 13205 0
lp 17759 0
parport 46345 3 parport_pc,ppdev,lp
usb_storage 48838 1
hid_apple 13237 0
hid_generic 12493 0
usbhid 46947 0
hid 100366 3 hid_apple,hid_generic,usbhid
firewire_ohci 40401 0
firewire_core 64368 1 firewire_ohci
crc_itu_t 12707 1 firewire_core
forcedeth 67156 0
I can't see the wl driver. Let's try to install it. From the wiki page we saw that the package we have to install is called bcmwl-kernel-source. Here is what we will do to install the driver.
First we will blacklist all Broadcom drivers not used to make sure they don't interfere with the newly installed driver. We will add the following lines to the blacklist file: /etc/modprobe/blacklist.conf:
# Blacklist unused Broadcom modules
Now we are ready to install the wl driver but first we have to install the linux-headers-generic package
sudo apt-get install linux-headers-generic
sudo apt-get install --reinstall bcmwl-kernel-source
$ sudo apt-get install --reinstall bcmwl-kernel-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 30 not upgraded.
Need to get 0 B/1,181 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 173145 files and directories currently installed.)
Preparing to replace bcmwl-kernel-source 188.8.131.52+bdcom-0ubuntu3 (using .../bcmwl-kernel-source_184.108.40.206+bdcom-0ubuntu3_amd64.deb) ...
Removing all DKMS Modules
Unpacking replacement bcmwl-kernel-source ...
Setting up bcmwl-kernel-source (220.127.116.11+bdcom-0ubuntu3) ...
Loading new bcmwl-18.104.22.168+bdcom DKMS files...
Building only for 3.5.0-21-generic
Building for architecture x86_64
Building initial module for 3.5.0-21-generic
$ sudo modprobe wl
We run the iwconfig command to find out if the wireless connection is working.
eth0 no wireless extensions.
eth1 IEEE 802.11 Access Point: Not-Associated
Link Quality:5 Signal level:208 Noise level:199
Rx invalid nwid:0 invalid crypt:0 invalid misc:0
lo no wireless extensions.
Just one more thing
Since Ubuntu 8.04 (Hardy Heron) the USB aluminum Apple Keyboard has not worked correctly. A change was added to the Ubuntu Linux kernel to make Apple MacBook keyboards gain additional functionality to their limited laptop style keyboard. Unfortunately this code change has some side effects for owners of the full size USB aluminum Apple Keyboard. Read more here. Here is a permanet fix for the international keyboard. Let's see if it works.
$ echo options hid_apple iso_layout=0 | sudo tee -a /etc/modprobe.d/hid_apple.conf
$ sudo update-initramfs -u -k all
We are up and running.
Cogratulations! Everything seems to work. We now have the best of two worlds (Linux and Mac OS X) running in the best computer (Apple).
10 things to do after installing Ubuntu 12.10
It seems to be very popular to write about things we should change or improve once we have Ubuntu up and running:
Here is a list of top 10 post-install must-dos.
Here is one more.
Here is a third one.
Things I have changed
When we move a window such that touches the top corner, the window automatically maximize to full screen. I don't like this behavior. Here is how change it.
- Install CompizConfig Settings Manager by executing this command: sudo apt-get install compizconfig-settings-manager
- Launch CCSM and go to the Grid configuration page.
- Change Top Edge to something else then Maximize. (Don't use None it seems to lock all the windows).
When searching the web for information about dual boot of Mac OS X and Linux we will find a lot of information and most of the time it looks really complicated. When using Ubuntu 12.10 it was a very simple process. Things get better and better.