TechieMoe.com

The MacBook Pro Ubuntu Edition

Introduction:

Many times on LinuxForums I've come across folks who wanted to run Linux on an Apple computer. Most of the time the first question I ask of them is "If you have an Apple computer, why not just run OS X?" Until this past week, I could not have answered this question.

For several years I've run OS X on my Macbook Pro and been quite happy with it. The OS did what I wanted it to do and didn't get in my way. I've been able to do work and play on it just fine. For those of you unaware, I write Java software for a living. I also sometimes coach a high school computer science competition. I spend a lot of time writing Java code and investigating new and exciting features in the language. One such feature is JavaDB. It's completely new in Java 1.6, and can only be used with that version.

I run 1.6 at work and I was having such a good time playing with JavaDB that I decided to send myself the code to work with at home. This is where I hit a wall. When I got home I realized OS X uses an Apple-modified version of Java 1.5, and in all my searching I couldn't find any indication of when (or even if) Apple planned on releasing a new version of their JVM. Without 1.6, I couldn't utilize JavaDB.

For the first time, Mac OS X was getting in my way. This was disappointing to say the least. Throughout my life when computers have told me I couldn't do something I have tended to go to great lengths to prove them wrong. I decided to dedicate a couple of days to getting Linux installed on my Macbook Pro. Here is what happened.

  1. Initial Install
  2. Getting it Configured
  3. Conclusion
  4. References

Initial Install

For this install, I used the latest available Ubuntu at the time (Ubuntu 7.10 "Gutsy Gibbon). Unless specified otherwise I followed all the instructions as given from the Ubuntu Macbook Pro Wiki (see references). The first thing on the wiki says to use BootCamp to resize your existing OS X partition. That no longer works, since the Boot Camp Beta has ended with the release of Mac OS 10.5 (Leopard) and Apple has pulled the download links. Even if you find a download (I did), the program blows up and says the beta has expired.

I ended up trying to resize the partition using diskutil resizeVolume in the Terminal. I ran the command given on the "Partitioning" section of the Wiki. It gave me an error. I looked it up and someone said to verify my HD with Apple's Disk Utility. Lo and behold, I had errors. I rebooted into "Safe Mode" (hold Shift after the bootup sound) and the computer ran through all its diagnostics. That seemed to fix it since the next time I ran Disk Utility, it reported no errors.

Then I rebooted and issued the diskutil resizeVolume command again. This time it got past the "Verifying..." stage and made it to the "Resizing Volume" stage. I was cautiously optimistic. At 88% resizing, I got an error "No space left on device (28)." I reduced the size of the partition I was trying to create and tried again. Some research on that error message suggested that my Parallels virtual harddrive was the culprit, since the resizing utility couldn't move it. I uninstalled Parallels and tried again. This time it took, and I was instructed to reboot.

A check back in OS X revealed that yes, my OS X partition was indeed the size I wanted it to be. I must admit my fingers were crossed through this whole thing since I didn't have my OS X install discs handy to recover if something went terribly wrong. I installed a bootloader called rEFIt that supplants the Apple bootloader and lets you boot other things. It's cute and functional. When I inserted the Ubuntu CD, rEFIt recognized it and gave me a little Tux icon with an option to boot "from Linux CD."

Ubuntu 7.10 doesn't like something about my MacBookPro, which causes it to display garbage on the screen instead of booting the LiveCD. I assumed it was the ATI graphics card so I chose "Safe Graphics Mode." That worked. The LiveCD booted and I ran the installer.

I chose to manually partition and picked the free space I'd allocated earlier when I resized OS X. I followed the recommendations on the Ubuntu wiki to not use a SWAP parition (I have 2GB of RAM anyway) and tell GRUB to install to hd(0,2) rather than the default hd(0). Once again, I was uneasy about the odd GRUB config. I've installed other distributions in the past that went great up until I rebooted and found out GRUB wasn't installed properly.

rEFIt recognized my Linux install and gave me two options at reboot: OS X and "Boot from Linux parition 3." Soon I was looking at a native Ubuntu install on my MacBook Pro! The screen was stretched, so I decided to fix that first. While looking around I was told that a "Restricted Driver" was in use. Turns out my MacBook Pro's Atheros wireless chipset was detected and configured. How nice. My ATI card was not, but I figured I'd work on that later.

Getting it Configured

It kind of scared me when I rebooted after some X11 fiddling and was greeted by a blank screen. I figured I'd pooched something in the Xorg.conf and booted using the "Boot from first harddrive" option on the LiveCD. That gave me an eternally blinking cursor and nothing else. I rebooted again and edited the GRUB boot line to take out the splash screen. This actually gave me some information. It seemed to hang on "Running local boot scripts (/etc/rc.local)."

I let it sit there for a minute before I realized (upon hitting ENTER) that boot was finished, but the login prompt had not popped up. I hit ENTER a few more times and got a proper login prompt, logged in and ran:

sudo dpkg-reconfigure xserver-xorg

This successfully got me my X back. Next I decided since it was already broken I might as well go for the gold and try to install the ATI drivers from this tutorial. It's worth noting that I had a heck of a time getting Ubuntu to *not* use my wireless card. I was doing this install on my work network, which is hard-wired ethernet. I kept verifying that I could ping my router and various places but whenever I tried to visit at website I would get an odd redirect and an error. I wrestled with this for 15 minutes before I found out disabling "Roaming Mode" did the trick. Geez. I know it was proud to have configured my wireless correctly and all, but it didn't have to keep shoving it in my face.

The install of the ATI drivers was much easier than the last time I did it (several years ago). It's good to see that ATI is working to help simplify the process. I ran the install script and it popped up a graphical window much like a MS Windows install program. Next, Next, Finish and I was done. I noticed at this point that even though glxgears reported 3D was working fine, I could not enable desktop effects. The tutorial says this is because of an incompatibility with the version of Compiz (0.5). I went through the process described to install a more recent version. It's not a trivial process.

After following the above tutorial to the letter, I had lots of configuration screens and options to turn on and off, but nothing was actually showing up. I did some more research and found out that I needed to install xserver-xgl as well. Installed, restarted X and I had all the completely worthless eye-candy I could handle.

This was all fun until I tried to change my desktop theme with Emerald. That caused my window borders to disappear and the only way to get them back was to turn off desktop effects all together. I researched and researched, but found no solutions that worked. As an added bonus, now my ATI driver no longer worked and every time I started up GNOME I got random errors about applets not launching correctly. Thanks to some eye candy tweaking, my entire GUI just took a dump.

I was not at all pleased by the prospect of losing a day and a half worth of work but I trudged on anyway and reinstalled. This was all fine and dandy until I rebooted and found that no matter what I tried, I could not connect to the internet using my onboard ethernet. I could ping my router and other PCs on the network, but not access the outside world. In desperation, I enabled my wireless and tried to connect to a network. Then I disabled my wireless again. Lo and behold, I had ethernet again. That was strange.

I figured this time if I was going to screw it up, I'd do it first thing before I got anything else installed. I installed the official ATI drivers. All went well. Then I installed xserver-xgl and Tremulous (a 3D game to test things with). I rebooted X Windows. Effects were enabled, but ran like molasses in winter. It was obvious that my 3D driver wasn't being used.

I decided to screw it and remove XGL. I began to see the same problems I noted earlier. Apparently this was one of the troublemakers from earlier. I tried running glxgears and got molasses again. I reinstalled the ATI driver and had no change. Finally, I let Ubuntu's Restricted Driver Manager download its version of the ATI driver and rebooted. That seemed to fix things (although I did notice that my FPS in glxgears were slightly lower compared to the official ATI driver). At this point I vowed to never again try and install Compiz or XGL.

I tweaked a bunch more settings using the tutorials and got my touchpad working with two-finger right-click and two-finger scrolling. I also had to tweak the power management settings because for some reason when on battery Ubuntu wanted to dim my screen if I was idle for more than 2 seconds.

Conclusion

I got it working. It can be done. Was it easy? Not on your life. I *do not* recommend this for anyone who isn't fairly well insane already, because it will certainly be enough to push you over the edge. Only the most dedicated enthusiasts need apply.

References

The Ubuntu Macbook Pro Wiki
The Ubuntu MacBook Community Documentation
Getting Compiz Fusion to work on a Macbook Pro