Ubuntu’s latest release, 10.04, was officially posted this week. Overall, it is a very impressive effort and a milestone for the Open Source community. I have installed it on a new cheap desktop I recently built and it runs fantastically with fast boot times and nice desktop eye candy.
The one thing that spoils this effort is the continued hassles in getting wireless wifi cards working. I have a half dozen usb wifi sticks lying around and only one just works our of the box. I guess it wouldn’t be Linux if one didn’t have to at least compile a driver or two every now and then?
Anyway, I recently purchased the Asus PCE-N13 IEEE 802.11b/g/n PCI Express Wireless Adapter.
I bought the card on sale for $19.99 and on the basis that someone left comments that it worked in Ubuntu 10.04. Not sure what this fellow’s definition of working is but it doesn’t just work at least when you use WPA security. So, determined not to let this get the better of me, I embarked on a flurry of google searches.
This card uses the Ralink RT2860 chipset which is used in many products. The problem from what I’ve been able to determine is that the WPA source code definitions are wrong by default. It’s not clear why this is so but that seems to be the case. The fix and ultimate configuration is fairly straight forward if one can find clear and accurate instructions. There’s the rub.
I finally stumbled upon some good instructions but maddeningly they contained key errors that will surely frustrate the uninitiated. So, in the interest of helping those that follow, I offer my amended instructions that I have tested and believe to be accurate. With this guide you should be able to get a Ralink RT2860 based product running and connected to a secure router running WPA security and will do so after reboots.
The following steps were performed on a unmodified default Ubuntu 10.04 final code install.
Step 1
Download latest RT2860 driver source code from Ralink here. You need to enter a name and an email and press accept to download.
Step 2
Open and extract the downloaded file to a temporary directory in your Home directory.
Step 3
Using an editor such as the default Gedit, open the driver source code file ./os/linux/config.mk. Use the find command to locate HAS_WPA_SUPPLICANT and make sure it is set to yes. It should look like this when finished:
HAS_WPA_SUPPLICANT=y
and do the same for:
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
Close and save this file.
Step 4
Using an editor such as the default Gedit, open the file ./common/cmm_wpa.c. Use the find command to locate MIX_CIPHER_NOTUSE. Replace this entire line (keep on one line)with this code:
WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;
Step 5
Perform these commands in a Terminal session one at a time. You can cut and paste. Using sudo puts you into Admin mode so you will be prompted for you Admin (probably) your default password.
sudo make
sudo make install
sudo ifconfig wlan0 down
sudo rmmod rt2860sta
Step 6
Rename the old rt2860sta.ko driver file to rt2860sta.ko.dist using a command such as:
sudo mv /lib/modules/2.6.*/kernel/drivers/staging/rt2860/rt2860sta.ko rt2860sta.ko.dist
Note you need to replace the asterisk with the actual directory name of your kernel. Consult your file system directory structure for this.
This is to prevent the old driver from being used. You could just delete the file as well I suppose.
Step 7
sudo depmod -a
sudo modprobe rt2860sta
After you issue the previous command you should see the Desktop top panel Wireless icon come to life as it tries to connect. You will be prompted for a WPA password. Give it a little while and it should connect.
Not sure this command is necessary but you can use if the Wireless isn’t started automatically.
sudo ifconfig wlan0 up
Step 8
Okay at this point you have made a lot of progress and should be happily surfing at up to 802.11n speeds. Take a break and marvel at your skills and the wonder of the Internet!
Step 9
But, and this is a biggie, what happens if you ever reboot? Unfortunately, you are back at square one without the RT2860 driver being loaded after a reboot. To remedy this situation, read on.
Step 10
Copy the newly compiled driver from your temporary build directory in ./os/linux using a command like:
sudo cp rt2860sta.ko /lib/modules/2.6.*/kernel/drivers/staging/rt2860/
Again replace the asterisk with the correct directory name.
Step 11
Update your modules boot file with the following command:
gksudo gedit /etc/modules
Add the command rt2860sta on a line at the end of the file.
Close and save the file.
Step 12
Reboot and check to see that you are now automatically connecting to your wireless network!
I hope this tutorial may be helpful for some people.