Installing TP-LINK TL-WN727N USB Wireless N 150Mbps Adapter on Debian Squeeze

Lets start with the product, TP-LINK L-WN727N is a USB Wireless N Adapter, and it has 150Mbps throughput on 802.11n Wireless Networks, it uses the RT5370 Chipset from Ralink (Link). The price from a local store here in Greece is 8 Euros, which makes this adapter very attractive low-cost solution. You can read more on product’s specification page here

This thing was tough… it took me almost 10 hours of posts reading, downloads, installs, builds to find a clean and easy solution to make it work, but first i must thank the VirtualBox for its support, without it the procedure of installing/cloning would have took me more than 24 hours.

I think that the problem mainly caused by the kernel hardware support of Debian Squeeze which is too old to support this chipset because the same adapter works out of the box on Debian Wheezy which is currently in testing stage with newer kernel (3.2.5), but i dont like the idea of working on test releases. Anyway, The result is tested with latest Debian Squeeze 6.0.4-i386 installation.

Step 1: Gather The files

First we need the drivers which fortunately are available through chipset maker’s Ralink website, i have downloaded from this url the latest drivers which currently are the version, The downloaded filename is 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2 which is wrong and it needs to be renamed to 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.tar.bz2 because it really is a tar archive compressed with bzip2.

Step 2: Compile and install the driver

After you have obtained the drivers file, put it in your box and do the following in order to uncompress/compile/install the driver:

root@debian:~# tar jxvf 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.tar.bz2
root@debian:~# cd 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO
root@debian:~/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO# make
root@debian:~/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO# make install

Next, Download and install latest non-free ralink firmwares:

root@debian:~# wget
root@debian:~# dpkg -i firmware-ralink_0.35_all.deb

Now if everything finished without errors you are ready to plug in your usb adapter, and verify that the system “see” it and has loaded the needed modules, in my situation the output was:

root@debian:~# dmesg
<----- TEXT OMMITED ----->

[   51.276088] usb 1-2: new full speed USB device using ohci_hcd and address 3
[   51.951155] usb 1-2: New USB device found, idVendor=148f, idProduct=5370
[   51.951159] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   51.951162] usb 1-2: Product: 802.11 n WLAN
[   51.951163] usb 1-2: Manufacturer: TPlink
[   51.951165] usb 1-2: SerialNumber: 1.0
[   51.953625] usb 1-2: configuration #1 chosen from 1 choice
[   52.046122] rtusb init rt2870 --->
[   52.046354]
[   52.046354]
[   52.046355] === pAd = e1ec6000, size = 517232 ===
[   52.046356]
[   52.047306] <-- RTMPAllocTxRxRingMemory, Status=0
[   52.047409] <-- RTMPAllocAdapterBlock, Status=0
[   52.054416] usbcore: registered new interface driver rt2870
root@debian:~# lsusb | grep 5370
Bus 001 Device 003: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
root@debian:~# lsmod | grep 5370
rt5370sta             575832  0
usbcore                99329  5 rt5370sta,usbhid,ohci_hcd,ehci_hcd

Step 3: Configure WPA/PSK and Automatic activation on startup.

The created network device name is ra0, Ralink's driver doesnt need the help of wpasupplicant in order to join WPA/PSK networks, it has its own way to do this. After you plugged in the USB Adapter, the module dynamically created a configuration file for the adapter and stored in as /etc/Wireless/RT2870STA/RT2870STA.dat, now open it with your favorite editor and change the values below to match your setup:

WPAPSK=<your wpa password>

If you want to start the wireless connection on system's startup, just add the below lines to your /etc/network/interfaces file:

auto ra0
iface ra0 inet dhcp

If you dont, add only the below line in your /etc/network/interfaces file:

iface ra0 inet dhcp

Now, you can "pull up" your connection manually from command line with the command:

root@debian:~# ifup ra0

or just reboot your machine to test it.

Thats it, i hope this guide will help some people out there who bought the same device or similar with the same chipset and trying to figure out how to use it in current Debian's stable release at least until Wheezy goes stable and this guide will get obsolete

22 thoughts on “Installing TP-LINK TL-WN727N USB Wireless N 150Mbps Adapter on Debian Squeeze”

  1. Thanks also from my side, it was of great use to me.
    Before compiling the module I changed the configuration file according to the README to use wpa-supplicant, had troubles without that before.

  2. I followed all of ur instructions but when i reboot the system, my wifi adapter does not start. I cant start it manually either i keep getting this error.
    Cannot find device ra0
    Failed to bring up ra0

    Ive been trying to get this crazy thing workin for a week, any help would be great thx

      1. I have the same issue….running the commands mentioned above I get the right outputs…how can I fix it?
        I don’t set the RT2870STA.dat file because I have a WEP key network.

        1. You need to set .dat file with the wep setting too, here are the settings for WEP:
          inside /etc/Wireless/RT2870STA/RT2870STA.dat fill these settings to fit your setup

          Key1Str=<your WEP key>

  3. When I execute ‘make’, I get an error message saying “/lib/modules/2.6.32-5-powerpc/build: No such file or directory. Stop.”

  4. Good guide! Very simple! Installetion went flawlessly! The divice is recognised and working.
    However when I get it connected, I get this:

    Listening on LPF/ra0/00:0f:53:80:33:2c
    Sending on LPF/ra0/00:0f:53:80:33:2c
    Sending on Socket/fallback
    DHCPDISCOVER on ra0 to port 67 interval 8
    DHCPDISCOVER on ra0 to port 67 interval 9
    DHCPDISCOVER on ra0 to port 67 interval 21
    DHCPDISCOVER on ra0 to port 67 interval 11
    DHCPDISCOVER on ra0 to port 67 interval 12
    No DHCPOFFERS received.
    No working leases in persistent database – sleeping.

    What would it be?

    1. Update: iwlist ra0 scan shows connections available… Seems nm-applet doesn’t show the ra0 interface. How do i make it appear in nm-applet?

      1. Check out the REAME file contained in the driver’s directory I think there is such options in the makefile but not sure

  5. If you are using Debian “squeeze” and NetworkManager and you see this error:

    DHCPDISCOVER on ra0 to port 67 interval 12
    No DHCPOFFERS received.
    No working leases in persistent database – sleeping.

    make sure that:

    1. You don’t add any mention of ra0 to your /etc/network/interfaces file:

    iface ra0 inet dhcp <– don't add to /etc/network/interfaces file

    because any mention of an interface (ra0, for example) in /etc/network interfaces will stop NetworkManager from handling the device.


    2. Follow the instructions in README_STA_usb to compile the driver for NetworkManager.

    This is what worked for me."Wireless Networks (Ralink 802.11n wlan)" now shows up in NetworkManager
    along with "Wireless Networks (Atheros AR9285 Wireless Network Adapter (PCI-Express))". Either interface can connect.

  6. Hi, thanks for posting the steps.

    I tried to compile the sources but I got the following error:

    root@moe:/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO# make
    make -C tools
    make[1]: se ingresa al directorio `/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/tools’
    gcc -g bin2h.c -o bin2h
    make[1]: se sale del directorio `/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/tools’
    cp -f os/linux/Makefile.6 /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/Makefile
    make -C /usr/src/linux SUBDIRS=/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux modules
    make[1]: se ingresa al directorio `/usr/src/linux-3.0.31′
    CC [M] /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.o
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2227: error: unknown field ‘private’ specified in initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2227: warning: initialization from incompatible pointer type
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2228: error: unknown field ‘num_private’ specified in initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2228: warning: excess elements in struct initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2228: warning: (near initialization for ‘rt28xx_iw_handler_def’)
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2229: error: unknown field ‘private_args’ specified in initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2229: warning: excess elements in struct initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2229: warning: (near initialization for ‘rt28xx_iw_handler_def’)
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2230: error: unknown field ‘num_private_args’ specified in initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2230: warning: excess elements in struct initializer
    /home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.c:2230: warning: (near initialization for ‘rt28xx_iw_handler_def’)
    make[2]: *** [/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/../../os/linux/sta_ioctl.o] Error 1
    make[1]: *** [_module_/home/antonio/desarrollo/pgcomp/redes/driver/2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux] Error 2
    make[1]: se sale del directorio `/usr/src/linux-3.0.31′
    make: *** [LINUX] Error 2

    Could you please give any hint?

    Linux moe 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686 GNU/Linux

    Best regards


  7. Wow! This worked great! I got one of these for my litecoin mining box and after a ton of messing around these are the only instructions that really worked.

    Since the blog post is pretty old, the download locations have moved. I got the



    and firmware-ralink_0.35_all.deb from:

    Finally to get it to connect to my Apple Airport Extreme, I had to tweak some settings. It is using WPA2 encryption so:

    In /etc/Wireless/RT2870STA/RT2870STA.dat .. i set:


    Then it worked like a charm! Thanks for the blog post!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top