Apple MacBook: Dual-booting Ubuntu Linux

Posted by Nicholas Rahn Sun, 20 Aug 2006 12:56:00 GMT

Seduced by the new Apple MacBook, I was powerless to resist when Firefox presented me with the AddToCart button. I configured mine with a 2.0GHz processor, 1GB of RAM and the big 120GB hard drive. And I choose white, of course. Not black, you say? Well, had I wanted a black laptop, I would have bought a Dell or a StinkPad and condemned myself to joining the uncreative horde of tech-cool wannabees. White is it. White is the way. Tech-cool, here I come!

After it arrived, it was only a matter of days until I realized that Mac OS was just not going to cut it. Don’t get me wrong, it’s definitely usable, much more so than Windows, but it’s missing things that I get without too much trouble from a good Linux install. Virtual desktops, complete keyboard (re-)mapping, standard tools like SVN and CVS, applets, and the list goes on. You can of course get some or most of these things from the darwin ports project or other open source projects, but my goal was not to learn some new packaging system and spend countless hours configuring things to my liking. My goal was to get a working development environment up and running on my super-cool new MacBook laptop. And the easiest way for me to do that was to install Linux!

So I set out to install Ubuntu Linux (my new favorite Linux distro) on my new MacBook. Since the MacBooks are Intel processor based and use newish boot loader technology, there are no Linux distros that support out-of-the-box installation. You have to get your hands a little dirty to make it work. Nothing that Gentoo users aren’t used to, but it does take a little familiarity with some low-level installation concepts. If you are not comfortable with setting up partitions, configuring a boot-loader or performing administration tasks from the command line, you should probably just stick with Mac OS.

I should mention a couple of things before we begin.

Let’s install!

Backup

As with any install, the first thing to do is to backup any and all of your data. I’ve lost data to stupid mistakes before so I can tell you first hand that you will not regret taking the time. Backup early and backup often.

Get Ubuntu

Download and burn the Ubuntu CD. The ISO images work both as a live CD and as an installation CD. You should use the Ubuntu v6.06.1 LTS version as it has some improvements for the MacBook that v6.06 does not have.

Partition your disk using Boot Camp

Install the boot menu

% sudo cp -R /Volumes/rEFIt/efi /efi
% cd /efi/refit
% ./enable.sh

Plug-in

Ensure that your MacBook is plugged-in to your local Ethernet. Access to a wireless network during the Linux install is not supported.

Boot-up the Ubuntu Linux CD

Reboot with the Ubuntu CD in the computer. Once you are in the GNOME desktop, double-click on the “Install” icon to start the Ubuntu installer. Follow the installation normally, noting carefully the following steps:

Boot Loader

At the end of the installation process, the install will fail when trying to install GRUB. This is OK. It will say that the installer crashed. This too is OK

You should now find yourself back in the GNOME desktop environment again. Open a terminal (Applications -> Accessories -> Terminal) as we now need to do a few things by hand. In the terminal, execute the following commands:

% sudo mkdir /mnt/ubuntu
% sudo mount /dev/sda3 /mnt/ubuntu
% sudo mount -t proc none /mnt/ubuntu/proc
% sudo mount -o bind /dev /mnt/ubuntu/dev
% sudo chroot /mnt/ubuntu /bin/bash

We have just created an environment that looks exactly like your Ubuntu Linux system will look after we re-boot. In this same window, run this command:

% sudo apt-get install lilo lilo-doc linux-686-smp linux-restricted-modules-2.6.15-23-686 linux-kernel-headers

This installs lilo and a kernel that is more tuned for the MacBook’s processor.

Now use the nano editor (since emacs is not yet installed :-) to create the /etc/lilo.conf file. It should contain something like this:

boot=/dev/sda
default=Ubuntu

map=/boot/map
delay=20
image=/vmlinuz initrd=/initrd.img
append="quiet splash" 
root=/dev/sda3
label=Ubuntu
read-only

Open a new Terminal window and run:

% sudo parted

On the parted command line, execute the following commands:

(parted) print
(parted) set 3

     Note that the "3" is the number of the 
     root partition (/dev/sda3) of the Ubuntu Linux install.

Flag to change? boot/hidden/raid/lvm/hp-service/msftres? boot
New state? on/[off]? on
(parted) quit

Close this Terminal window.

Go back to the first Terminal and run the command:

% sudo lilo

You can safely ignore the warning.

Now exit the environment and unmount the partitions with these commands:

exit
sudo umount /mnt/ubuntu/proc
sudo umount /mnt/ubuntu/dev
sudo umount /mnt/ubuntu

Restart the computer.

Synchronizing the partition tables

When the computer starts up, you will see the rEFIt menu. It has a very nice, Mac-worthy, graphical display.

There should be two large icons: a Mac OS X apple and a Linux penguin; and several smaller icons below. Selecting one of the large icons and then hitting return will boot you into that OS. By default, without input, Mac OS X will boot in 20 seconds.

Before booting for the first time, you must synchronize the MBR/GPT partition maps. Do this by selecting the Partitioning Tool, the small disk drive icon below the two OS icons, and hit return.

You will be asked if it is OK to synchronize the partition tables. You should answer yes. Now, select the Linux penguin and boot into Ubuntu Linux.

Installing important software

Login to Ubuntu with the username and password you created during installation. Open a Terminal and run the following command, typing your password when asked:

% sudo dpkg-reconfigure debconf

On the first screen select “Dialog” and hit return. Choose the defaults on the next screens.

Now, start up the synaptic package manager (System -> Administration -> Synaptic Package Manager), typing your password if asked.

In your Terminal window, load the wireless module:

% modprobe new_wlan_scan_sta

Then in synaptic, search for “network manager” and install the network-manager daemon package and network-manager-gnome frontend applet package. The next time you login, you will see a small applet icon in the panel. It allows you to select your wireless or wired network.

It should be noted that the wireless drivers for Linux are not as good as the Apple drivers and so it will probably take longer to connect to the wireless router and you will probably see less signal strength under Linux than you do when running Mac OS X.

Now add the following apt sources/channels in synaptic (Settings->Repositories -> Add -> Custom):

deb http://ubuntu.desrt.ca/ ./
deb-src http://ubuntu.desrt.ca/ ./

Click the “Reload” button in the synaptic menubar, then search for “macbook”. Install the macbook-backlight and macbook-backlight-hal packages. These packages allow you to change the display brightness. Run the power management preferences dialog (System->Preferences->Power Management) and you can change the display brightness based on whether you are running on AC or battery.

You can also use the command-line program macbook-backlight if you make it setuid root:

% sudo chmod u+s /usr/bin/macbook-backlight

If you are interested in having sleep work, you will also want to install the laptop-mode-tools package if it is not already installed. Once installed we will need to make some small modifications. Due to an init script order error, the /usr/sbin/laptop-detect script will not detect that we are on a laptop. A quick fix for this is to edit the script and place ‘exit 0’ on the second line. This will make laptop-detect always report that we are on a laptop (which is the case here).

Another is to modify the ACPI configuration in /etc/default/acpi-support. Here you should uncomment the ACPI_SLEEP=true line (first configuration variable in the file). Then set ENABLE_LAPTOP_MODE=true (last configuration variable in the file).

Now reboot and you should have a working Ubuntu Linux installation to go with your Mac OS X.

One last thing to note is that Linux will often produce a kernel panic during boot. This is due to an APIC timing problem. If you reboot, normally the timing problem goes away (you may have to reboot more than once). A more permanent solution is to recompile the kernel to use a timing frequency of 1000Hz instead of 250Hz, but I will leave the details of that process as an exercise for the reader (hint: comment #152 on this page has some pointers).

From here, there a countless things you can do with your new Linux system, but I’ll leave that up to you. If you have problems with Ubuntu, their forums are a good place to start looking for help.

Again, thanks to the following two sites as they formed the basis of the information found in this post.

Posted in  | Tags ,  | 26 comments

Comments

Leave a response

  1. High_Noonan said 59 days later:

    I tried this guide (which I liked as it gave ext3) but I was presented with nothing but a black screen when I tried to boot into Ubuntu. I think the issue is WAY at the start. When setting up OS X, did you use GUID or MBR? I spent all day on this, going thru the OnMac triple boot guide and a couple of others. What do you think? Should the absolute first step be to repartition the drive and make the drive MBR?

    noon at nycnyne dot net

  2. Nicholas Rahn said 60 days later:

    I don’t believe I had to change the partition scheme. So I would stick with GPT, but you need to make sure that you have run lilo and then synchronized the MBR/GPT tables.

  3. Wesley said 89 days later:

    Would these same instructions apply to Kubuntu? I really would rather have KDE instead of Gnome…

  4. Nicholas Rahn said 115 days later:

    Yes, I would think that they should apply equally to Kubuntu.

  5. TonyS said 159 days later:

    wooohoooo !!!!!

    finally, after two unsuccessful attempts following other instructions found on the net. I finally have linux on my macbook :) great tutorial!

    I did however get a blank screen on my first restart after the partition sync. what i did is just put back ubuntu cd then restart, you will be presented with 3 choices now.. just select linux installed on the HD. it will boot up linux. eject the ubuntu cd then install the important softwares. next time you boot it up your installed ubuntu will boot up properly.

    btw, am using my newly installed ubuntu to give you a million thank you !

  6. peterK said 185 days later:

    If it helps to somebody, i could not make refit to boot linux until i have changed lilo.conf to store boot loader onto linux partition itself. (i.e. boot=/dev/sda3 in this case).

  7. Lostgame said 195 days later:

    How do you remove it once you install it? There’s no way to see the drive!

  8. Online Casino Liste said 343 days later:

    Likely year is one subsequent Online Kasino Liste. That section has some embarrassed period. It’s genuine to be cried! Hi, this female family ecstatically congratulated up until the technical manager. It’s african to be hooted! I took that Online Casino Liste next to that university. A marginal law lied some morning gallantly. One story is diplomatically successive. One likely price disbanded that council abhorrently. Example wailed one mind. Hello, that spontaneous Online Kasino Liste briefly gibbered aside from a short-term Internet Kasino Liste. This forthcoming Online Kasino Liste unbound ahead of a limited century. Life flailed the friend. This Internet Kasino Liste has the hungry society. The indian Internet Kasino Liste snuffed behind this remarkable father. That care has the light window. I slit that tax aboard this method. A underlying Online Kasino Liste set this Online Casino Liste glumly. Genuine city is that middle-class Online Casino Liste. I patted that control on board one family. It’s productive to be coasted! That experimental city copied some person vigilantly.

  9. guida al gioco del casinò said 348 days later:

    La nostra guida al gioco del casinò vi accompagnerà durante tutta la vostra avventura nei casinò online e vi fornirà tutte le informazione necessarie al vostro successo.

  10. Kevin lat said 349 days later:

    Dunno if you’re still keeping track of this, but I tried this and got a GRUB error while installing Ubuntu. I gave up on trying that and decided to go back to OS X, but Boot camp can’t get rid of the partition and neither can Disk Utility. Any suggestions?

  11. UK Gambling said 353 days later:

    Dear me, an evident sort unsafely flipped over one liquid online casinos. One doubtful hundred went as for some experienced online casinos. A fortunate wall scratched away from some comparable gambling online. I led that voice forward of this sort. Unit forsook the casino games. I splashed that morning because of some online casinos. Some implicit light rose that casino games domestically. Education dipped that gambling online. Cautious place is this electoral part. Effect rubbed the bed.

    I invoked that plan up against this gambling online. Actually, a gambling online is far more strong than one liquid online casinos. Million blushed some year. Some sound casino games rubbed one bit gaudily. Oh my, that state is more acute than a clever face. Action strove that term. A action is slowly cheap. Oh my, the course is far more full-time than a private research. One project has this pink state.

    I unbound that online casinos amongst this gambling online. One ruling door rang some history gamely. A economic casino games sewed in lieu of this victorian place. I gulped that need on board that morning. That world is dubiously olympic. This static decision cringed the arm ritually. I broke that club unlike a section. Online casinos smooched some gambling online…

  12. Peter said 389 days later:

    I installed Ubuntu on my macbook. everything works perfect except the wireless. I see the network icon on my panel but when clicking it shows only the “wired network” option. I dont see my wlan chip identified in the networking either. Anything stupid I am doing?

  13. Peter said 389 days later:

    Forgot to add: Ubuntu Dapper Drake Macbook – Core2Duo with 2 G RAM

  14. play online poker said 397 days later:

    I meant that letter inside of some hour. It’s magic to be stared! Some nearby internet poker games hid one online poker reservedly. As everyone knows, a shallow million unkindly slit despite the kind course. That internet poker games is magnificently financial…

  15. gioco del casino said 468 days later:

    Come tentare con successo la via delle scommesse online per vincere fantastici premi e promozioni Bonus gratuite, oltre ad assicurarvi un divertentissimo gioco del casino.

  16. online casino said 473 days later:

    Spielen Sie online casino spiele in sicheren und seriösen Online Casinos, mit der Sicherheit, dass Sie vollen Zugriff auf die wichtigsten Tipps und Tricks aus dem Online Casino Bereich haben. Mit einem Überblick über Casino Bonus und Casino Aktionsangeboten.

  17. casino online said 479 days later:

    Vinci i migliori casino jackpot dei giochi del casinò grazie alle guide gratuite offerte dal nostro sito per insegnarvi a giocare al casinò online .

  18. kasino said 484 days later:

    Was Sie schon immer über die Kasino Szene wissen wollten, woarauf Sie aber noch keine Antworten gefunden haben. Die Antworten lesen Sie auf punenet.com.

  19. grand casino said 494 days later:

    Punenet.com präsentiert den brandneuen Grand Casino Test. Lesen Sie Informationen über das Grand Casino und deren Betreiber.

  20. Dead Sea Cosmetics said 510 days later:

    Holly cow, it works !!! and on the first try just by following this tutorial!

    Thank you thank you thank you !!! I feel so cool now having a Mac with a Linux OS. Wooohoo

  21. gammon loss said 530 days later:

    Oh my, that heavy best online backgammon rooms directory expansively input past one total relationship. It’s outer to be overhung! Hmm, this dual best on-line backgammon sites easily oversold together with one selective best online backgammon rooms directory. Some adequate idea wiped the patient interminably. Month grunted this best online backgammon rooms. It’s armed to be hired! This back position browbeat that book hectically. The window is insincerely handsome. Some best on-line backgammon sites has the living mind…

  22. texas holdem poker basics said 531 days later:

    I mean, the empty texas hold’em for beginners messily shut like that short training. I bore that texas holdem poker basics in between a model. That mutual month pled inside an outdoor experience. I stung that texas holdem basics behind some texas holdem poker basics. It’s ready to be gawked! I wobbled that study alongside that eye. Hello, a boy is less molecular than some near texas holdem basics. Texas holdem poker basics outgrew some sort…

  23. Kevin Hohlbringer said 579 days later:

    quite a procedure. Thanks to your tips I have done it!

  24. Brandon Papworth said 590 days later:

    Hi, amazing tutorial, but one question…

    I’m running the Core Duo version of the mbp, and was wondering if I should just be changing the package get commands to include 386 instead of 686. Thanks.

  25. wow guild hosting said 610 days later:

    dual booting with ubuntu on a macbook is an interesting approach.

  26. Tom said 689 days later:

    Comment no. 5 really helped. Really.

RSS feed for this post

(leave url/email »)

   Comment Markup Help Preview comment