2011/06/12

Fixing the rt2860 wifi chipset under Ubuntu 11.4

I have a Medion Akoya MD96888 that ran ubuntu just fine from day 1. Unfortunately, with the latest Ubuntu versions the wifi connection is really unstable, unreliable and very slow. This post explains how to identify the problem and how to resolve it.

Diagnosis
The following commands will identify which driver ubuntu uses for your wifi card:
nm-tool
...
- Device: wlan0 ----------------------------------------------------------------
Type: 802.11 WiFi
Driver: rt2800pci
State: disconnected
Default: no
HW Address: 00:22:43:13:7F:7B

Capabilities:

Wireless Properties
WEP Encryption: yes
WPA Encryption: yes
WPA2 Encryption: yes ...

 lsmod | grep rt2800pci
rt2800pci 18159 0
rt2800lib 43824 1 rt2800pci
rt2x00pci 13986 1 rt2800pci
rt2x00lib 39075 3 rt2800pci,rt2800lib,rt2x00pci
eeprom_93cx6 12653 1 rt2800pci

sudo lshw -C network
*-network
description: Ethernet interface
product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: eth0
version: 02
serial: 00:21:85:4c:75:cc
size: 100Mbit/s
capacity: 100Mbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full ip=192.168.1.60 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:42 ioport:d000(size=256) memory:ffd10000-ffd10fff memory:ffd00000-ffd0ffff memory:dfd00000-dfd0ffff
*-network
description: Wireless interface
product: RT2860
vendor: Ralink corp.
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
Conclusion: ubuntu uses the rt2800pci driver for accessing the RT2860 wifi chipset. This driver causes the instability.

Solution
Currently the only solution is to download the driver directly from Ralink and manually compiling and installing it. Although the command line steps are quite tedious, I did get a stable wifi back. The following steps are copied and slightly updated from http://ubuntuforums.org/showthread.php?t=1592731.

  1. Download latest RT2860 driver source code from Ralink at http://www.ralinktech.com/support.php?s=2. The driver is tagged RT2860PCI/mPCI/CB/PCIe(RT2760/RT2790/RT2860/RT2890). Put the tar into your home directory.

  2. Extract the tar file and go to the expanded directory (ignore the bz2 extensions, bunzip2 won't work):
    tar -xvf ~/2010*
    cd ~/2010*
  3. Edit the config.mk file:
    gedit ./os/linux/config.mk 
    Find the following lines (by default set to "n") and set them to be "y":
    HAS_WPA_SUPPLICANT=y
    HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
    Save and close the file.

  4. Back in the terminal window perform the following command
    gedit ./common/cmm_wpa.c
    For the warning message choose "Western" then "Retry".

    Use the find command to locate "MIX_CIPHER_NOTUSE". Replace the entire line with this code:
    WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;
    Save and close the file.

  5. Make sure gcc is installed (usually is by default but if not install it via synaptic) then from the terminal window perform the following commands:
    sudo make
    sudo make install
    sudo ifconfig wlan0 down (on some hardware it is ra0)
    sudo rmmod rt2860sta
    sudo mv /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/rt2860sta.ko /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/rt2860sta.ko.dist
  6. Still in the terminal window perform the following commands:
    sudo depmod -a
    sudo modprobe rt2860sta
    sudo ifconfig wlan0 up (on some hardware it is ra0)
  7. Check that network manager can now select networks and connect to them.

  8. Back in the terminal window perform the following command:
    sudo cp ./os/linux/rt2860sta.ko /lib/modules/$(uname -r)/kernel/drivers/staging/rt2860/
  9. In the terminal window perform the following command:
    gksudo gedit /etc/modules
    Add "rt2860sta" on a line at the end of the file then save and close it.

  10. Reboot and check that wifi still works


Post a Comment