Friday, November 15, 2013

MediaTek/Ralink WiFi Adapter in Raspberry PI

How to make MediaTek/Ralink MT7601 work with Raspberry Pi

I bought USB WiFi adapter for my Raspberry Pi recently. The adapter had a MediaTek MT7601 chip. I was eager to create a media center for my home. I installed OpenElec and hoped everything would work. OpenElec worked great but it did not include a driver for the relatively new MediaTek MT7601.

I googled around but could not get any ready-made drivers. Finally, I decided to download the driver source and compile it myself.

This driver works with following configuration:

$ lsusb
Bus 001 Device 004: ID 148f:7601 Ralink Technology, Corp.

OpenElec did not allow me to write to /lib, /etc directories. So, I ended up installing Raspbian which allowed me to edit /lib, /etc directories.

How to use this driver:

  • Copy mt7601Usta.ko to /lib/modules/<version>/kernel/drivers/net/wireless
  • Create directory /etc/Wireless/RT2870STA
  • Copy RT2870STA.dat to /etc/Wireless/RT2870STA directory
  • Run sudo depmod -a
  • Add the below text to /etc/network/interfaces. Note that quotes around SSID and password are required
auto ra0
allow-hotplug ra0
iface ra0 inet dhcp
  • Change the permissions of this file to 600, so that only root can read your wireless network password
# chmod 600 /etc/network/interfaces
  • Reboot!
  • Run lsmod to verify if the driver is loaded
$ lsmod
mt7601Usta            798542  1 
  • Run ifconfig to make sure that the network interface ra0 is available

Update on 22 June 2014

My recent firmware update to 3.12.22+ broke the driver. I recompiled the driver with 3.12.22+ kernel version.

Firmware version Driver
3.6.11+ Dropbox link
3.12.22+ Dropbox link


    • Look for hints from output of dmesg command


    talesofmrgalen said...

    thanks very much for providing the drivers and instructions, finally got mine working too. i think you also need a step to register the module "sudo depmod -a" after the copying is done.

    Unknown said...

    Hi, thanks for your effort, for me it points in the right direction. I used your drivers, but there is a mismatch in system:

    pi@raspbmc:~$ uname -a
    Linux raspbmc 3.10.21 #2 PREEMPT Tue Dec 3 04:35:37 UTC 2013 armv6l GNU/Linux

    So, a man's got to do what a man's got to do: compile myself...

    My questions:
    - which source did you use? I saw 2 versions at MediaTek
    - cross compile or did you compile on the pi?
    - any pitfalls?
    - any suggestions?

    Maybe this is the place to publish a small howto...

    kind regards, --Edgar

    Gowtham said...

    @talesofmrgalen - yes, I had missed it. Thanks, I just included "depmod -a"

    Gowtham said...

    @Edgar Hildering

    - I downloaded latest version v3.0.0.4
    - compiled on the pi. I guess it did not take too long
    - I guess it is most important to get the correct Module.symvers for your kernel

    CyberKuki said...

    Did you compile the drivers for Raspbmc? Did it succeed? If yes: Could you post them please?

    tony.stark said...

    Linux raspbmc 3.10.24 #2 PREEMPT Mon Dec 23 05:18:12 UTC 2013 armv6l GNU/Linux

    I fail to compile drivers..
    How did you do it??

    tony.stark said...

    If possible could you pass on the .ko-s for above version?

    Gowtham said...

    @tony.stark Driver source includes a makefile. Do you see any compilation error?

    Here is some more info:

    Paul VA3PAW said...
    This comment has been removed by the author.
    Paul VA3PAW said...

    I noticed that the driver writes lots of debug trace data into logs.
    To fix that, I used:

    iwpriv ra0 set Debug=0

    as suggested by

    Unknown said...

    Hello and thanks for compile the firmware,

    I have update my Debian to 3.12.22+. I put the RT2870STA.dat into /etc/Wireless/RT2870STA, and the file mt7601Usta.ko into the directory /lib/modules/3.12.22+/kernel/drivers/net/wireless/. Then i did sudo depmod -a but when I do lsmod the module don´t appear and if I connect the dongle the raspberry fail.

    Can you say what did you did to compile?. Thanks

    Paul VA3PAW said...

    Here is how I compiled it:

    Unknown said...

    when i compile i recive the next error:

    make: *** /lib/modules/3.6.11+/build: No such file or directory. Stop.

    make: *** [LINUX] Error 2

    Marco Farias said...

    HI, I've just finished compiled the driver with 3.12.24 kernell Raspberry, works great!! VA3PAW is perfect! Thanks.

    Aardvark said...

    Thank you for the detailed directions! I picked up three of these MT7601 adapters to deploy on several Raspberry's (currently hardwired) and was rather displeased to see they were not supported right out the box (it was hard to tell on eBay exactly what chipset was being supplied). I am running 3.12.22+ and that also made it a bit more difficult as I found drivers for 21 and 24 initially (thanks for posting the 22+ drivers!). I have now got one device up and running with the MT7601 so it does indeed work. The only thing I am curious about is if there is a way to disable logging from the driver. I am getting a pile of "rt28xx_get_wireless_stats" messages in my kern.log file

    albag57 said...

    Hi, thanks a lot for the driver. It works fine on my Raspbiam 3.12.22 kernel wit TP-Link 727N v4 Dongle. But if I run Openelec it does not recognize the Dongle and no connection. Any idea? Alberto

    Unknown said...

    I updated the raspbian to 3.12.26 tru rpi-update. The 3.12.22 driver appears not to work.

    [ 5.789065] mt7601Usta: disagrees about version of symbol skb_put
    [ 6.033116] mt7601Usta: Unknown symbol skb_put (err -22)
    [ 6.040188] mt7601Usta: disagrees about version of symbol __netif_schedule
    [ 6.471700] mt7601Usta: Unknown symbol __netif_schedule (err -22)
    [ 6.651989] mt7601Usta: disagrees about version of symbol unregister_netdevice_queue
    [ 6.805928] mt7601Usta: Unknown symbol unregister_netdevice_queue (err -22)
    [ 6.818634] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory
    [ 6.935037] mt7601Usta: disagrees about version of symbol pskb_expand_head
    [ 7.017611] mt7601Usta: Unknown symbol pskb_expand_head (err -22)
    [ 7.115259] mt7601Usta: disagrees about version of symbol skb_copy_expand
    [ 7.202029] mt7601Usta: Unknown symbol skb_copy_expand (err -22)
    [ 7.263573] mt7601Usta: disagrees about version of symbol dev_kfree_skb_any
    [ 7.272181] mt7601Usta: Unknown symbol dev_kfree_skb_any (err -22)
    [ 7.354991] mt7601Usta: disagrees about version of symbol skb_pull
    [ 7.398141] mt7601Usta: Unknown symbol skb_pull (err -22)
    [ 7.430271] mt7601Usta: disagrees about version of symbol dev_close
    [ 7.453217] mt7601Usta: Unknown symbol dev_close (err -22)
    [ 7.460379] mt7601Usta: disagrees about version of symbol skb_push
    [ 7.474599] mt7601Usta: Unknown symbol skb_push (err -22)
    [ 7.482442] mt7601Usta: disagrees about version of symbol register_netdev
    [ 7.490996] mt7601Usta: Unknown symbol register_netdev (err -22)
    [ 7.498679] mt7601Usta: disagrees about version of symbol free_netdev
    [ 7.506729] mt7601Usta: Unknown symbol free_netdev (err -22)
    [ 7.514038] mt7601Usta: disagrees about version of symbol kthread_stop
    [ 7.522065] mt7601Usta: Unknown symbol kthread_stop (err -22)
    [ 7.529438] mt7601Usta: disagrees about version of symbol netif_rx
    [ 7.537176] mt7601Usta: Unknown symbol netif_rx (err -22)
    [ 7.544041] mt7601Usta: disagrees about version of symbol __netdev_alloc_skb
    [ 7.552493] mt7601Usta: Unknown symbol __netdev_alloc_skb (err -22)
    [ 7.560201] mt7601Usta: disagrees about version of symbol skb_trim
    [ 7.567811] mt7601Usta: Unknown symbol skb_trim (err -22)
    [ 7.574624] mt7601Usta: disagrees about version of symbol kthr
    ... and so on.

    How can I get the driver updated to 3.12.26?
    Thanks in advance.

    Aardvark said...

    Unfortunately the driver is version dependent on the kernel and needs to be rebuilt for each version. I have a build environment and been building them for the various kernels along with drivers for the Realtek RTL8188EU chipset.

    I put a gzipped tar of the latest MT7601 drivers (3.12.22+, 3.12.25+ and 3.12.26+) on my employers ftp site at . We have some Raspberry Pi's so I am building drivers occasionally.

    Unknown said...

    Thanks Aardvark,
    It worked perfectly for 3.12.26+.
    You saved me this time.

    Aardvark said...

    Glad to help. I'll be keeping it updated and expect to update the tar file when 3.12.27+ comes out.

    Fernando said...

    Hello, everything was ok for me, It worked following your instructions. But I wonder why I have to insert the "auto ra0" in "interfaces" file. I have another wifi dongle that worked out of the box (other brand) and I use wpa_supplicant to configure the SSID and password (and fixed ip address) so I get the wlan0 device as usual. Is there any way to do that way? because I removed the "auto ra0" lines and it doesn't work at all. Thank you!

    Fernando said...

    Ok, I managed to do it that way into the "interfaces" file:

    allow-hotplug ra0

    iface ra0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface ra0 inet static

    But, Why should be ra0 and wlan0 as I currently have does't work?...

    Aardvark said...

    ra0 is how the driver creates it. I suppose one could dig through the drivers source modules to find where the name is defined and change it to wlan. However, there are posts on other forums that use link files as well as renaming the device to wlan0 at boot. The RTL8188 driver that I also build does create wlan0 so this ra0 stuff is just Media Tek's way of bring different.

    Balan said...

    Hey Aardvark..

    The driver is working fine (in my 3.12.28+) Thanks for providing it.

    It would be very helpful if you could also describe how to build such drivers?


    Aardvark said...

    I followed the detailed instructions to build the drivers at The only change is that for subsequent Raspbian versions, you need to "git fetch" in order to update the root you previously downloaded using "git clone".

    Balan said...

    Hi Aardvark,
    Thanks for the link. :)
    Will this driver supports hostapd? because when installed and tried hostapd i am getting the below error

    $ sudo service hostapd start
    [FAIL] Starting advanced IEEE 802.11 management: hostapd failed!

    when i tried
    sudo hostapd -d /etc/hostapd/hostapd.conf

    i got
    Line 2: invalid/unknown driver 'mt7601Usta'

    any fix??? :(

    Unknown said...

    This really helped me when I was on 3.12.22+. But then yesterday I updated to 3.12.28+ and no-joy. Just an FYI that I was able to easily" get it up and running using this;

    *Not my build, it came from Alfonder at link below *

    cd /tmp
    sudo tar xf mt7601_3.12.28_710.tar.gz -C /
    sudo depmod 3.12.28+
    sudo reboot

    From here:

    Fernando said...

    Thank you Trend, works on 3.12.28+. But I still have a problem because when I reboot the Raspberry it loose the Ip address. The only way I found out to get the Ip back is switch off and on. Can anyone test it? I have another Wifi adapter (another brand) and it does not happen.

    balansp said...

    I finally managed to install the driver and able to connect to my home WIFI.

    but i am unable to start my Hostapd

    $sudo hostapd -d /etc/hostapd/hostapd.conf

    throws erorr as

    nl80211: 'nl80211' generic netlink not found

    Colin said...

    Hey everyone compiled the latest on my Raspberry Pi up to 3.12.31+ so if anyone needs it.

    Unknown said...
    This comment has been removed by the author.
    Unknown said...

    it won't work for me and i'm not sure why. I followed all of the steps and rebooted and now the Ethernet doesn't work either! Can you provide a fix please

    DingoBat said...

    @Colin You are my hero, mate! This is the driver I was looking for. But I'm a noob and I don't know the SSH commands to install once downloaded.

    Can you help? Do I extract and then PSCP the two files? All help appreciated.

    DingoBat said...

    I'm on RaspBMC btw...

    erle said...

    Hey bro,

    I wanna thank you. You're a timesaver. Now my TP-LINK TL-WN727N works with the newest image of raspbian (3.12.28+). I used to downgrade my kernel just so I can use this wifi adapter. And the installation used to be so painful. Now it is painless. Thank you again.


    cool273.15 said...

    I have updated the driver for 3.12.32+

    Additionally in the read-me I have mentioned the process I followed to compile the module

    Unknown said...

    I have been beating my head into the wall on this thing and I think I am in a knowledgeable place to know how to ask the right questions.

    I put my kernel to 13.12.32+ (note: using your most recent link) and I do all the necessary steps up until I have to "sudo depmod -a" where I get the error:

    ERROR: failed to load symbols from /lib/modules/3.12.32+/kernel/drivers/net
    /wireless/mt7601Usta.ko: Exec format error

    I initial ran the default update/upgrade/rpi-update stuff and it took me to Kernel 3.12.33+ and then I downgraded in hindsight. Is that where I messed up? Do I need to start with a fresh raspberian install?

    Thanks for any help

    cool273.15 said...

    Richard blanchette ..

    did you copy the file in this folder??

    Copy RT2870STA.dat to /etc/Wireless/RT2870STA directory

    then run the depmod command..
    then follow the rest of the instructions.

    Unknown said...

    Thank you very much,

    I successfully got ra0 interface,
    but i am unable to get ip to ra0
    dynamically. please help me in this.

    cool273.15 said...

    Add the below text to /etc/network/interfaces. Note that quotes around SSID and password are required

    auto ra0
    allow-hotplug ra0
    iface ra0 inet dhcp

    and then reboot

    Unknown said...

    Thanks for quick reply,

    I am doing same, but no use

    # cat /etc/network/interfaces

    auto ra0
    allow-hotplug ra0
    iface ra0 inet dhcp
    wpa-ssid "Bhaskar-room"

    # ifconfig ra0
    ra0 Link encap:Ethernet HWaddr 00:17:7C:34:33:8C
    RX packets:17892 errors:0 dropped:0 overruns:0 frame:0
    TX packets:152 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:4520563 (4.3 MiB) TX bytes:12196 (11.9 KiB)

    # lsmod
    Module Size Used by
    mtnet7601Usta 31906 1
    mt7601Usta 980859 1 mtnet7601Usta
    mtutil7601Usta 35683 2 mtnet7601Usta,mt7601Usta

    cool273.15 said...

    Is there a problem with your router.
    check with some other router

    Unknown said...

    Thanking you for your support sir, DHCP is working good now.

    isc-dhcp-server this package is missing..

    Sorry for troubles you :)

    albag57 said...

    Hello to all.
    some months ago I wrote that the driver works fine on my Raspbiam 3.12.22 kernel wit TP-Link 727N v4 Dongle. But if I run Openelec it does not recognize the Dongle and I can't have any connection. Is there anybody who can help me in solving this issue? I imagined, once dongle worked wit Raspberry it has to work even in Openelec: am I losing in a glass of water??

    Tomáš F. said...

    Hi Aadvark,

    I've tried to use your 3.12.26+ driver on my rpi but I'm getting:
    "ERROR: could not insert 'mt7601Usta': Exec format error"

    I'm running
    3.12.26+ #8 PREEMPT Sat Aug 16 15:59:35 CEST 2014 armv6l GNU/Linux

    Any ideas?


    Alberto said...

    Hi, I have problems to compile the driver for 3.16.3 and 3.17.7 kernel version.

    Anybody cold help me?

    A lot of thanks!

    Dennis said...

    Can someone post the source? MediaTek/Ralink seems to have fallen off the radar...

    Anonymous said...

    I've uploaded the driver here
    I got the driver from the cd that came with the adaptor

    I've tried to compile it on 3.18.5+ today but it gives error.
    the .dat file was generated but .ko file was not.

    If you have some luck in this then please post the drivers and also tips if any

    Unknown said...

    Hi, cool273.15, thank you for the driver, it works for me. Are you using raspbian for compiling of cross-compile this driver? If so, could you share the steps needed to have the driver compiled on your host? I'm trying to build it, but have an file format error all the time when I try to install the driver in the system.

    Thank you, Dmitry

    cool273.15 said...
    I have updated the driver for 3.12.32+

    Additionally in the read-me I have mentioned the process I followed to compile the module
    December 4, 2014 at 7:53 AM

    chuc2rk said...

    Could you help me compile for openwrt!

    Unknown said...

    Misi gan, izin share ya...

    ONE 14-Z1401-C2H9 (320GB)
    Price Rp 3.499.000

    Learn more about

    Brief Specs :
    Intel 2840, 2 GB DDR3, 320 GB HDD,NIC, Intel HD Graphics, 14" WXGA, Non OS

    Pusat Belanja Komputer

    Terimakasih :)

    BABABA said...

    my recalbox ethernet is not working after i followed this tut, wifi is also not working, now how do i make ethernet work again as i cant access recalbox in network

    BABABA said...

    i thank my lord savior who made me clone my 64 gb card 2 months ago, i had to use that image to restore my destroyed recalbox after using this method posted here. this tutorial didnt fix shit for me, edup 802.11n mini usb adapter. rasp pi 2