The World

[as I find it]

Getting gNewSense running on a MacBook

I have a second-generation MacBook (bought in spring of 2007), and due to a bunch of recent issues which have turned me off from OS X (e.g., the machine randomly will fail to wake up from sleep, compiling software is a huge pain, etc.), I have been aroused from my complacency and have decided to try my hand at getting gNewSense, an all-free software derivative of Ubuntu, running. I didn’t expect this to be an entirely painless or automatic process — I had tried Ubuntu on the same hardware a little over a year ago, and found it to be lacking — but I needed a distraction from studying for the GRE, and so I dove in last weekend and burned a LiveCD.

I am currently running gNewSense DeltaH, which is based on Ubuntu’s Hardy Heron release. I have found the out-of-the-box hardware support to be surprisingly good: I didn’t need to install any special packages to get the screen resolution right, to get the mouse working, or to get the keyboard working before boot (all of which were issues with Ubuntu when I tried it a year ago). The gNewSense installer worked perfectly fine, and gave me a happily-booting system without any additional configuration on my part.

The rest of this post will be dedicated to the things I had to do to get the system working to my satisfaction after the initial installation. Even though the hardware support is impressive, especially for a distribution which makes a point of removing any and all binary-only “blobs” from the kernel, there are a few things which I have found necessary to get a system which will eventually allow me to fully replace OS X. I’m documenting them here for my own benefit, and for the sake of anyone else who might be considering running gNewSense or Ubuntu on a MacBook.

1. Getting the wireless card working. Prior to doing any system updates or installing any packages I might want, I had to get a working Internet connection. We share a wireless connection here, so plugging in direct was not really an option for any length of time. I used the madwifi drivers, which are not available as a gNewSense package (though they are now available in Ubuntu’s linux-restricted-modules package, according to the madwifi wiki). I don’t understand the licensing issues involved, because the COPYRIGHT file in the madwifi distribution says its source code is dual-licensed under the BSD and GPL licenses, which is good enough for me.

There was one snag trying to get the wireless drivers to compile. gNewSense DeltaH installs both the linux-image-2.6.24 and linux-image-2.6.24-generic kernels, but only the generic version properly uses both CPU cores, so that is naturally the one I was using. However, the default installation does not install the kernel headers for the generic kernel build, so madwifi would not compile against it. Therefore, it was necessary for me to plug into the wired connection and run

$ sudo apt-get install linux-headers-2.6.24-generic

before I could compile madwifi. Once the Linux headers were installed, though, running

$ make
$ sudo make install

in the madwifi directory worked flawlessly, and the kernel loads the driver at boot.

Update: after installing the linux-libre kernel, version 2.6.29-1, from Uncle Gnufs’ World Famous Home Baked Free Kernel Shoppe, wireless works without the Madwifi drivers. The built-in ath9k driver is used instead, and I have experienced no problems with it so far.

2. Getting the mouse working. The MacBook touchpad mostly works after a default installation, but a couple of features are missing that I really need and enjoy:

  • right-clicking
  • two-finger scrolling

Right-clicking is a must-have in any modern desktop environment, and it was actually the more difficult problem to solve. I am still not sure if I like the solution, but for what it’s worth, this will work:

  1. Install the xkbset package:

    $ sudo apt-get install xkbset
  2. Create a file ~/.Xmodmap, and add the line:

    keycode 115 = Pointer_Button3

    Key code 115 is for the left Apple key. You can use a different key if you wish; use the “xev” program to determine what the key codes for different control keys are.
  3. On the System menu, go to Preferences -> Keyboard. On the “Mouse Keys” tab, check “Allow to control the pointer using the keyboard.”
  4. On the System menu, go to Preferences -> Sessions. On the “Startup Programs” tab, click “Add.” Enter what you like for the name and comments; the command should be:

    xmodmap /home/username/.Xmodmap && xkbset m

    (replacing “username” with your actual username).

  5. Restart X with Ctrl-Alt-Backspace.
  6. The LEFT Apple (Command) key will now simulate a right-click wherever the mouse pointer is.

At the moment, this solution is only working for me some of the time, and it doesn’t have the “native” feel of OS X’s Control-click for rightclick. (Indeed, you don’t have to click the mouse button at all to get a right click.) This feels uncoordinated to me, because the key is not a modifier for a normal mouse click (the way it is normally a modifier for a keypress); instead, it is a mouse click. This means that whatever key you choose must be solely dedicated to right-clicking. If anyone comes up with a better way to make a key/mouse-click combination function as a right click while still preserving the normal function of that key elsewhere, I would love to hear about it.

Two finger scrolling is easier to set up, though I don’t have it working as smoothly as in OS X yet either. Simply add these lines to your /etc/X11/xorg.conf file in the section which has the “Synaptics Touchpad” identifier:

Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"
Option "TapButton1" "0"

(If you don’t want horizontal two finger scrolling, set that to “0” instead of “1”. The third line turns off tapping on the touchpad as a click; leave it out if you like being able to click with a tap.) There are a couple of issues with this so far. First of all, the touchpad seems too sensitive to me: two-finger scrolling goes very fast, and accidental brushes of my palm or thumbs on the touchpad can have drastic effects on whatever I’m doing in a way they never did in OS X. Second, the right side of the touchpad also appears set up to be a scroll zone, which is redundant and unhelpful for me; I fixed this via the GUI (System -> Preferences -> Mouse -> Touchpad -> uncheck “Enable vertical scrolling”) but I don’t know how to set this permanently in the Xorg configuration, which I would like to do. Again, suggestions are welcome.

3. Installing GNU IceCat. IceCat is the GNU Project’s version of the Firefox browser. I much prefer it to Epiphany (which was mysteriously eating my downloads), and it adds some nice security features that Firefox doesn’t have. Downloading the .deb from and installing it with dpkg worked fine.

Update: I’m having some difficulties getting Gnash, the GNU Flash player, to work with IceCat. I tried installing mozilla-plugin-gnash via apt-get and creating a link to the installed from the IceCat plugins directory…and IceCat promptly crashed when I tried to open a Flashy site. I am going to assume that this is due to some kind of version conflict between the mozilla-plugin-gnash package and IceCat, and try compiling from source next.

Update 2: I compiled Gnash from source, and it works at last! I still can’t play videos on Hulu or YouTube, because they use Flash 9, and Gnash doesn’t have support for them yet, but oh well. Here are the steps to compile Gnash and the plugin for IceWeasel:

  1. Install dependencies:

    $ sudo apt-get install libboost-dev libboost-thread-dev libagg-dev libsdl1.2-dev libgstreamer0.10-dev libatk1.0-dev libatk1.0-dev libglib2.0-dev libgtk2.0-dev libungif-dev libjpeg-dev libboost-dev libboost-thread-dev libagg-dev libsdl1.2-dev libgstreamer0.10-dev libatk1.0-dev libatk1.0-dev libglib2.0-dev libgtk2.0-dev libgif-dev libjpeg-dev libxml2-dev libcurl3-dev libboost-date-time-dev libboost-serialization-dev
  2. Obtain the Gnash 0.8.4 source .tar.bz2 from
  3. Unzip the sources:

    $ tar xjvf gnash-0.8.4.tar.bz2
    $ cd gnash-0.8.4
  4. Configure the build for GTK (not KDE) and to install the IceCat plugin:

    $ ./configure --with-plugindir=/usr/local/lib/icecat-3.0.1-g1/plugins --enable-gui=gtk
  5. Make and install:

    $ make
    $ sudo make install
    $ sudo make install-plugins

4. Fixing font rendering. This solution comes from Deep Thought. Add this XML to ~/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<match target="font">
<edit name="autohint" mode="assign">

Other outstanding issues:

  • Sound
  • Sleeping/hibernating: the system does sleep (suspend to RAM) and resume, but after doing so, I can’t switch from GNOME to one of the text-based virtual terminals (e.g., via Ctrl+Alt+F2) — they’re all black.

That’s all for now. I will update this post as I discover solutions for other issues.


Written by whereofwecannotspeak

October 19, 2008 at 11:51 pm

%d bloggers like this: