Get the Ralink 28xx USB Dongle Running on Raspbian 7 (Raspberry Pi)

There are a variety of extremely cheep USB wifi dongles available on ebay that work wonderfully… once you get them working. I picked one up for $4 for my Raspberry Pi and had trouble getting it to work under Raspbian. Here’s what you need to do for the current Ralink USB adapters out there.

EDIT: this whole thing might no longer be relevant according to Andre in the comments. Give this a try before going through the whole manual route:

apt-get install firmware-ralink
  1. First, update your system to the latest everything with `sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade`.
  2. Make sure you have a Ralink adapter. You should see it in `dmesg` output, and possibly even if `ifconfig -a` if the driver is partially loaded. Something like this should be seen in dmesg:
    [    3.404457] usb 1-1.3: Product: 802.11 n WLAN
    [    3.417642] usb 1-1.3: Manufacturer: Ralink
  3. If you see the adapter listed in ifconfig, try `sudo ifconfig wlan0 up`. You will likely get a message that says:
    SIOCSIFFLAGS: No such file or directory

    And dmesg will show:

    [  158.917437] ieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
    [  158.954363] ieee80211 phy0: rt2x00lib_request_firmware: Error - Failed to request Firmware

    That means have the kernel modules installed but we’re missing firmware. We need to download it and put it where the OS expects it.

  4. Install git:
    sudo apt-get install git-core
  5. Clone the linux kernel firmware repo and move the appropriate file to where the OS expects it. Note you need about 110MB of space to do this clone.
    git clone http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
    sudo cp linux-firmware/rt2870.bin /lib/firmware/rt2870.bin
  6. Then try `sudo ifconfig wlan0 up` again. You shouldn’t get an error!

Configuring WPA

  1. Install wpasupplicant:
    sudo apt-get install wpasupplicant wireless-tools
  2. Set up /etc/network/interfaces so we can use ifup and ifdown to manage wireless, and to start the interface on boot.
    The post-up command below disables wireless power saving mode on the card. Without this command, power saving causes very high latency on the connection, with pings taking 1000ms or longer in some cases.

    auto wlan0
    iface wlan0 inet dhcp
    wpa-driver wext
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    post-up /sbin/iwconfig wlan0 power off
  3. Lastly, configure your WPA settings in /etc/wpa_supplicant/wpa_supplicant.conf.
    ctrl_interface=/var/run/wpa_supplicant
    network={
            ssid="your_ssid_here"
            psk="your_passphrase_here"
    }
  4. Now all you need to do is `sudo ifdown wlan0` then `sudo ifup wlan0` and you should see the DHCP lease be obtained. Reboot for good measure to make sure the interface comes back up on boot.

7 thoughts on “Get the Ralink 28xx USB Dongle Running on Raspbian 7 (Raspberry Pi)”

  1. It took me a whole day trying and trying, then I found this Website and in a few minutes the wlan-dongle was operating! Thank you very much!

  2. 30 months later this article helped me realize I was missing the ralink driver! But instead of cloning the linux-firmware repository, I just installed the firmware-ralink package from my distro:

    apt-get install firmware-ralink

    Hope it helps…

Leave a Reply

Your email address will not be published. Required fields are marked *