Support > Hardware Compatibility

Ralink RT2870 based USB Wireless N adapters (Ubuntu)

(1/50) > >>

Mark Greaves (PCNetSpec):
For kernels >= 2.6.35 make sure you read the the EDIT.

If you want to know which kernel you are using, open a terminal and enter:

--- Code: ---
uname -r
--- End code ---
(if it's greater than, or equal to 2.6.35, be sure to follow the instructions in the EDIT.

In Ubuntu 9.10 (Karmic), Ubuntu 10.04 (Lucid), and Ubuntu 10.10 (Maverick) there is an issue with USB Wireless N adapters based on the Ralink RT2870 chip.
The issue seems to be that 2 (conflicting?) driver modules are loaded... rt2870sta and rt2800usb... resulting in no wireless access.

The solution is to blacklist the rt2800usb module if it is loaded.

To see if they are both loaded, enter this in a terminal:

--- Code: ---
sudo lsmod | grep rt28
--- End code ---
if they are both loaded, blacklist the rt2800usb module by opening the /etc/modprobe.d/blacklist.conf file (as root)

--- Code: ---
sudo gedit /etc/modprobe.d/blacklist.conf
--- End code ---

and add the line:

blacklist rt2800usb

then save the file and reboot.

If after rebooting you can now 'see' the network, but it will not accept a WPA key (WEP seems fine)... you need to recompile the driver with WPA support... the driver can be found here:

2010_0709_RT2870_Linux_STA_v2.4.0.1.tar.bz2 (you can enter 'any' name and email)
Ralink Linux Driver Page
(HINT - change the files extension to tar.gz before unpacking... for some reason it comes up as an invalid bz2 archive, but unpacks properly as a tar.gz)

Before compiling - you are going to need to install build-essential, and linux-headers-generic.

--- Code: ---
sudo apt-get update && sudo apt-get install build-essential linux-headers-generic
--- End code ---

If you use WPA/WPA2 encryption, you will have to change the lines

(inside the unpacked driver)


Once you have changed these to =y and saved the file...

Newer kernels >= 2.6.35 will fail to compile (make) the driver because the driver makes use of the functions usb_buffer_alloc() and usb_buffer_free() which were renamed in kernel 2.6.35 .. so if during the next (make && make install) step it fails with this error:

--- Quote ---make[2]: *** [/home/mark/Desktop/RT2870/os/linux/../../common/cmm_mac_usb.o] Error 1
make[1]: *** [_module_/home/mark/Desktop/RT2870/os/linux] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-27-generic'
make: *** [LINUX] Error 2
--- End quote ---

or similar.

The fix is to cd to the driver source directory (eg. 2010_0709_RT2870_Linux_STA_v2.4.0.1), and run the following 3 commands which will clean the build directory and replace the old calls with the new ones:

--- Code: ---
make clean
find . -name \*.[ch] -exec grep usb_buffer_alloc "{}" ";" -exec sed -i 's/usb_buffer_alloc/usb_alloc_coherent/g' "{}" ";"
find . -name \*.[ch] -exec grep usb_buffer_free "{}" ";" -exec sed -i 's/usb_buffer_free/usb_free_coherent/g' "{}" ";"
--- End code ---
(hitting enter after each line)

Or, I've uploaded a pre-modified version of the driver that WILL compile on kernels >= 2.6.35 here:

Then carry on with the "sudo su" and "make && make install", as per the instructions below.

To compile and install, open a terminal and enter:

--- Code: ---
sudo su
make && make install
--- End code ---
It is important here not to use "sudo" alone, but "sudo su" because with sudo for some reason the installation script fails to create the necessary files and folders.

Now, while still root modprobe the driver module:

--- Code: ---
modprobe rt2870sta
--- End code ---

Give it a minute to create the ra0 device node, and network manager should now be able to display all visible wireless networks in your area, meanwhile you can stop being root.

--- Code: ---
--- End code ---

Make sure that ra0 is up and running as it's supposed to:

--- Code: ---
--- End code ---

and check for a section similar to:

--- Quote ---ra0 RT2870 Wireless ESSID:"" Nickname:"RT2870STA"
Mode:Managed Frequency=2.412 GHz Access Point:
Bit Rate=54 Mb/s
RTS thr:off Fragment thr:off
Link Quality=100/100 Signal level:-29 dBm Noise level:-71 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
--- End quote ---

To make sure the module is loaded after a reboot, add it to the /etc/modules file:

--- Code: ---
sudo sh -c 'echo rt2870sta >> /etc/modules'
--- End code ---

Your wireless card should now be working (it may require a reboot first)... Use network manager to set your WEP/WPA(2) key, and connect to your network.

Further info can be found at the following URLs:

Hi Mark

I have been looking for a solution to this problem for ages on and have tried allsorts with my patchy but growing knowledge of linux.  I am now running xubuntu 11.04 on an ancinet laptop.  The USB wifi unit is recognised in 11.04 without the need for blacklisting and I can see my network but canont login.  On  your modified driver for later kernals do I need to change thge WPA_Supplicant info or have you done that already? I am going to try this tonight.

I must say this is the clearest linux forum that I have come across.



Mark Greaves (PCNetSpec):
I've NOW changed the WPA settings to Y in the pre-modified driver :)

Hi Mark,

Thank you very much for the tip on the compilation error, this certainly saved me quite a bit of trouble.

I'm up and running now (on Natty), but I notice that iwconfig is only reporting 54 Mb/s. As I have an "N" speed router & adapter (and is configured as such), shouldn't I be seeing speeds higher than this?

Thanks again...

Mark Greaves (PCNetSpec):
Are there any slower wireless devices connected to the router ?

AFAIK, a mixed mode b/g/n wireless router (or access point) will default to the slowest protocol depending on what devices are connected wirelessly.
(ie. an 802.11n router that supports b/g/n will scale back to 802.11b if a device with only 802.11b capabilities connects to it... slowing ALL other device connections)

You could try changing the (default) configuration:
line in

--- Code: ---
sudo gedit /etc/Wireless/RT2870STA/RT2870STA.dat
--- End code ---

to force a Wireless "N" connection.
(be aware, if there are any slower devices connected to the router this mode may leave you unable to connect)

Some people say setting it to:
helps, in mixed mode... ie.dropping support for 802.11b and/or 802.11a

WirelessModes -

     0: legacy 802.11b/g mixed
     1: legacy 802.11b only
     2: legacy 802.11a only
     3: legacy 802.11a/b/g mixed
     4: legacy 802.11g only
     5: 802.11a/b/g/n mixed
     6: 802.11n only
     7: 802.11g/n mixed
     8: 802.11a/n mixed
     9: 802.11b/g/n mixed
   10: 802.11a/g/n mixed

Don't forget to save the RT2870STA.dat file, and restart the wireless (or reboot).

It's all in the README_STA file in the driver archive ;)


[0] Message Index

[#] Next page

Go to full version