So, it seems that it is possible to get the last feature that I really, really wanted to use on my MacBook, NetworkManager, to work under Ubuntu Edgy without a custom kernel. The steps involved are not difficult, but they are tricky, due to an interlocking matrix of bugs. Thanks to some insomnia and procrastination I've decided to write it up.
Reader beware! These steps are designed to work around a particular set of bugs on a particular revision of Ubuntu for a particular piece of hardware. If you're reading this at some point in the future, chances are that the madwifi project has already produced a driver. To find out, check to see if madwifi ticket 1001 has been resolved before you do any of this.
If you are running Ubuntu Edgy, with the default kernel, and you have a black rev.2 MacBook and you want to get NetworkManager working without screwing around with Feisty kernels, read on.
- First, you will have to build your own ndiswrapper.
You need at least version 1.29, which is quite a bit newer than the version packaged with edgy. I chose 1.31 - not too old, not too new.You need at least version 1.43. (Earlier versions seemed to work, but 1.44 was the first version I installed which could suspend and resume reliably and did not very occasionally produce random crashes.) These instructions may very well work with older ornewer revisions, but I am not going to build a big revision matrix; the whole point of this is a temporary workaround. Install it with "make uninstall; make install" to make sure to remove ubuntu's packaged ndiswrapper driver first. Keep in mind that if you upgrade your kernel via apt, you may need to repeat this step, so keep the sources around. Next, you will want to get the driver from d-link. Go to this page, and get version 1.02. Some discussion on the Madwifi page says to get version 1.01 instead because 1.02 crashes. Ignore it. As far as I can tell, it's just wrong. I originally followed this advice, which is why I thought that it crashed ndiswrapper; I also had other problems with version 1.01 such as not being able to associate with various public access points.See my later post about which driver to get. Anyhow, install the driver into ndiswrapper by unzipping the downloaded archive and running "
sudo ndiswrapper -i net5416.inf".
- Test to make sure the driver works. If you are already running NetworkManager and nm-applet, simply doing 'modprobe ndiswrapper' ought to set it up nicely and you should get immediate visual feedback that it is working.
- Configure the module to un-load itself when you suspend or sleep and re-load itself when you resume. This is important because otherwise ndiswrapper will not allow anything This is accomplished by editing the file /etc/default/acpi-support and changing the 'MODULES' line to say 'MODULES="ndiswrapper"'. While you're in there, you might want to also change the 'STOP_SERVICES' line to say 'STOP_SERVICES="mysql bluetooth "' instead of just mysql, since bluetooth is notoriously unreliable in the face of power management, and bluetooth connections, like wifi connections, will not survive a suspend/resume cycle anyway.
- Make sure that ndiswrapper does not create a 'wlan0' alias for itself; you probably don't need to do anything, but if you're using a different version of the ndiswrapper script, it may create a file called "/etc/modprobe.d/ndiswrapper" with an alias for "wlan0" in it. If you see this, remove it. NetworkManager knows about the module name 'wlan0' and will constantly try to load it if it becomes unloaded for some reason. This results in a particularly nasty race condition where the suspend machinery politely removes ndiswrapper in preparation for suspending and then NetworkManager loads it again, resulting in a hang from which it is impossible to recover without a hard reboot. I managed to create this situation for myself through experimentation, so it probably won't happen to you, but just in case make sure that file doesn't contain any reference to 'wlan0'.
- Test suspending and resuming and make sure that the driver loads as expected.
- Configure the driver to load at boot. This consists of editing the file /etc/modules and adding a line that says "ndiswrapper". DO NOT do this until you are sure the driver works with your machine; if it causes a crash, this might make your machine unbootable.