22 April 2007

Acerhk and Ubuntu

UPDATE: Some of these steps are no longer necessary on newer versions of Ubuntu. Check out my new post for the info.

With the new release of Ubuntu now available I raced ahead and installed it on my laptop. Of course no major upgrade goes without a hiccup and this one was no exception - my wireless networking stopped going. This wasn't entirely unexpected because I had to install a kernel module to get it going under edgy so I did that again under Feisty. Hopefully one day this will be installed by default in Ubuntu but we'll see. For now, if you're one of those unlucky soles with a laptop requiring acerhk to get the wireless going, check out these instructions - once you know and understand it, it's actually not that hard.

First you need the sources for the acerhk module. There's a couple of ways and places you can get this, but the easiest by far is to use this deb.

After you've downloaded the deb, double click to install. This part's easy! You'll just need to make sure you're connected to the net (presumably by wired network) for it to download some required dependencies. What this does is copy the source code for the module over to the required places.

Now we're going to use a very convenient program made for Debian called module-assistant. To install this, you can either use the command line or synaptic package manager. You'll need to have the multiverse enabled. (Not sure what this means or how to do it? Check out the Ubuntu Help Documentation)

Open up a terminal by going to Applications > Accessories > Terminal. First, make sure your repositories are up to date:

sudo apt-get update
Enter your password when asked. Now we need to install the module-assistant:
sudo apt-get install module-assistant
Open up the module-assistant by typing:
sudo m-a
You'll see a helpful blue and red screen. First, we need to prepare the assistant for installing modules, so select PREPARE and wait for it to finish. After that, select UPDATE.

Now we'll tell it to install the module. Select SELECT to see the list of modules, find acerhk and press space bar. Then tab to OK and press enter. Select BUILD and then select INSTALL. You've now installed the acerhk module! Exit the module assistant by pressing Esc repeatedly until you're back at the command line.

Now we need to make sure the module is loaded at the appropriate time and the wireless network enabled. We'll need to:
  • Ensure the module is loaded when Ubuntu boots.
  • Tell the acerhk module to enable the wireless both when the laptop is turned on and when it is resumed.
The easiest way to have the module load when Ubuntu loads is to add it to /etc/modules:
sudo echo acerhk >> /etc/modules
Now we're going to make a little script for turning on the wireless. Open up the text editor at Applications > Accessories > Text Editor. Create your script as follows:
echo 1 > /proc/driver/acerhk/wirelessled
Save it into a useful location with an appropriate name. I'm going to name it wifi and save it into my home directory.

Now ensure that the script is executable:
cd ~
chmod +x wifi
Then we need to copy the script to the two locations that will have it being executed on boot and resume.
sudo cp ~/wifi /etc/acpi/resume.d/
sudo cp ~/wifi /etc/init.d/
Phew! We're done. Reboot the laptop and hopefully your wireless is working! When the next Ubuntu version roles around all you should need to do is the module assistant build and install for the acerhk module.