November 11, 2011

Install Debian Squeeze on Macbook 8,1

debian

This year I came into possession  of a new MacBook Pro 8,1 laptop. Not my personal choice in hardware platforms but after some research it was actually a good value for the hardware. Of course the first thing I did was to attempt and install Linux. Unfortunately the newer hardware made it rather impossible to install the “Stable” version of Debian Linux. With some tinkering I was able to get Debian Unstable (Sid) running but a few weeks ago Debian Sid switched to Gnome-Shell (gnome3). Avoiding the new Gnome desktop environment I re-installed my O/S this time using Debian Testing (Wheezy.) Sure enough a few weeks later Wheezy was pushed the updated Gnome from Sid and I found myself in a real pickle. I spent an entire evening installing and tweaking to get Debain Stable (Squeeze) working. In the end I was very successful. This article contains the steps necessary in getting this running.

Resources

First here are some useful links that helped my in my endeavor:

http://wiki.debian.org/MacBookPro
http://refit.sourceforge.net/
http://backports-master.debian.org/
http://packages.debian.org/
http://x.debian.net/reference/squeeze-backports.html
http://ppa.launchpad.net/mactel-support/ppa/ubuntu/pool/main/m/macfanctld/

 Roadmap

  1. Install rEFIt
  2. Install Squeeze (64bit required)
  3. Upgrade Linux kernel
  4. Upgrade X server
  5. Fix wireless
  6. Fix keyboard
  7. Fix Cooling Fans
  8. Fix touchpad

Install rEFIt

I will not waste any space here re-hashing how to install rEFIt. I will simply make note that MacBooks use EFI and not BIOS as standard PCs do. Furthermore, rEFIt is the preferred choice in dealing with this incompatibility. There are detailed instruction on the rEFIt website (linked above) and countless other places on how to properly use rEFIt. I will, however, mention that in my experience, getting rEFIt to work correctly required several reboots and a complete power-off before it worked as advertised.

Install Squeeze (64bit required)

The installation of Debian Squeeze will require the 64bit (amd64) version if you want to get the wireless network adapter working. This can be downloaded from http://debian.org. It is also required that you have a physical network (CAT5) internet connect. The installation is pretty straight forward. I would recommend selecting “expert install” in Debian so that you have full control over the install process. When asked to partition your disk drive I created one large partition for Linux and a smaller partition for swap. This is not my preferred partition scheme, but I had some trouble getting more complex partition schemes to boot. In all I had a partition for EFI, a partition for OSX (dual booting), a partition for Linux (/), and a partition for Linux Swap.

After you complete the installation and you are asked if it is alright to install GRUB (the Debian boot loader) to the MBR make sure to select “NO!”  Installing to the MBR will definitely leave the system unable to boot. Instead I installed GRUB on my main Linux partition (/dev/sda3 – see above partition layout.)

Upgrade the Linux Kernel

After the initial Linux install, upgrading our kernel is the first step in getting our hardware working correctly. To upgrade we will install the kernel from Debian Backports (link with instructions above.) Add the backports repository to your /etc/apt/sources.list file and run (followed by a reboot of your system):

 sudo apt-get -t squeeze-backports install linux-image-amd64

 Upgrade the X.org Server

Although it might seem that there is no issue with graphics (even compositing seemed to work out of the box) there are several upgrades in newer versions of X which make it worth the upgrade. (The poor performance of X in the default Squeeze environment made my eyes bleed!) Great instructions on how to upgrade X from Debian backports is linked above. In short:

sudo apt-get install -t squeeze-backports xorg xserver-xorg xserver-xorg-core \
xserver-xorg-input-all xserver-xorg-video-all libgl1-mesa-dri libgl1-mesa-glx

Fix Wireless Network Adapter

The wireless adapter in this particular MacBook is identified as: Broadcom Corporation Device [14e4:4331] (rev 02). Unfortunately there is no native Linux driver for this adapter and requires the use of a Windows driver and ndiswrapper. To begin we need to install a few packages:

sudo apt-get install build-essential dkms

sudo apt-get -t squeeze-backports install linux-headers-2.6-amd64

Since we upgraded our kernel the ndiswrapper packages in squeeze are not compatible. Using the Debian package search website (linked above) search for and download the amd64 deb packages for: ndiswrapper-common, ndiswrapper-dkms, ndiswrapper-utils. After installing these packages you might find the gnome graphical ndis utility useful.

sudo apt-get install ndisgtk

You can get the Windows driver using “Bootcamp” in OSX or downloading it from various places on the internet.

Although I like the default network manager in Gnome, I found that Wicd was actually more reliable with this ndis driver:

sudo apt-get -d install wicd

sudo apt-get autoremove network-manager

sudo apt-get install wicd

Fix Keyboard / Apple’s Hotkeys / Back-lit Keyboard

There is a great Linux daemon called “pommed” that deals with the proprietary Mac keyboard hotkeys, back-lit keyboard, and display brightness. Unfortunately (like ndiswrapper) the default packages are not up-to-date enough for our hardware. Unlike ndiswrapper however the packages in Wheezy/Sid will not install in Squeeze due to dependency issues. To get around this I first downloaded the deb package from the Debian package search website. Then right-click and extract the package. Open the “control” file in the “DEBIAN” folder and remove the libasound2 dependency. Save the file and rebuild the deb file using:

sudo dpkg -b /path/to/extracted/folder

Cooling Fan Control

Like pommed their is a daemon to control the Mac cooling fans. It is called “macfanctld” and can be downloaded from the link above.

Fix Touchpad

Here are the steps I took to get the touchpad working well. For starters I used the default Gnome “Mouse Preferences” application to “disable touchpad while typing,” “enable mouse clicks with touchpad,” and enable “two-finger scrolling.” Next I installed “gpointing-device-settings” and used it to turn on “palm detection.” Finally, the touchpad is simply too sensitive. To fix this you can run:

synclient FingerHigh=40

Unfortunately this setting will not survive a reboot. So you can put this in a text file and make it a small bash script. Then using the “Startup Applications” utility in Gnome you can have this script executed on each and every login.

Read more from Debian, Linux

Share your thoughts, post a comment.

You must be logged in to post a comment.