Setting up a Wireless Network on Linux: Ralink 3062 and Network Manager

Ah, memories! These days, setting up hardware on Linux is often easier than it is in Windows. Lots of drivers are built-in and auto-detected, and many are provided through a distribution channel that makes it almost as easy.

Wireless networking, however, is a bit of a throwback to the old days. Half the hardware doesn’t have Linux drivers, and half of the devices that do require you to hunt for the driver — based on the chipset, of course, not on the name or model number on the box — and compile it yourself. (At least these days, you can sometimes run a tool to adapt the Windows drivers if there’s no native Linux option.)

The steps I actually needed to take to set up wifi on my Fedora 13 desktop probably only amounted to about 10 minutes. Unfortunately it took a lot of false starts to get there. I had installed a Zonet ZEW1642 PCI card, which my initial research suggested would be supported by the built-in rt2860 drivers. As it turned out, it wasn’t that simple.

First, what didn’t work:

  • Built-in drivers.
  • The rt2860 drivers (or any others) from RPMFusion.
  • Manually configuring the card with system-config-network (even after I got the right driver installed).

What did work:

  • Download the driver and firmware from Ralink’s Linux page Mediatek’s Downloads page.
  • Build and install the driver.
  • Start using NetworkManager.

Key Info

  1. lspci reports the card as:Network controller: RaLink Device 3062
  2. It doesn’t use the rt2860 driver.
  3. When the driver works, the card will show up as ra0 when you run ifconfig or iwconfig. If you run either of those and don’t see ra0, or if you try to configure ra0 and get a message like “unknown device,” you don’t have the right driver loaded.
  4. When the driver works, NetworkManager will automatically recognize it. You don’t need to configure the interface first. (This tripped me up several times.)
  5. The NetworkManager and network services conflict with each other. You have to pick one and disable the other.

Most of the information I found on this card…wasn’t actually about this card, but about related ones. What little I did find implied that it uses the same driver as the rt2860. It doesn’t. Well, not exactly. They use the same firmware, and the config file for the rt3062 is called RT2860STA.dat, which confuses the issue.

Howto

  1. Go to Ralink’s Linux page Mediatek’s Downloads page and download the appropriate driver and firmware based on the model number.
  2. Unzip the firmware
  3. As root, copy rt280.bin to /lib/firmware/rt2860.bin
  4. Unzip the driver source file (ex: tar xvf /download/linux/drivers/2010_07_16_RT3062_Linux_STA_v2.4.0.0.tar)
  5. Step into the folder and read the instructions in README_STA
    1. You probably won’t need to change the Makefile or set compiler flags, but you will need to set it to work with either NetworkManager or wpa_supplicant. So edit os/linux/config.mk and set HAS_WPA_SUPPLICANT=y and HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y (for NetworkManager). If you don’t change this, it will not work. (Don’t worry about the next coulple of lines about wpa_supplicant. They don’t seem to be necessary from what I can tell.)
    2. Build it by typing make in the main folder of the source archive.
    3. As root, copy RT2860STA.dat to /etc/Wireless/RT2860STA/RT2860STA.dat
  6. At this point, you can diverge from the directions a bit.
  7. To install, switch to root and run make install in the main folder of the archive. This should copy rt3562sta.o to the appropriate location for your system.
  8. If you haven’t been using NetworkManager, again as root, run service network stop to disable the standard network service (since it conflicts with NetworkManager).
  9. Enable the driver: again as root, run modprobe rt3562sta
  10. If you have NetworkManager running, it should immediately recognize the card and detect nearby networks.
  11. Once you’ve got everything working, as root, run chkconfig --del network to permanently disable the other daemon. (But make a note of this in case you ever switch back.)

One more thing: keep this folder around! Because of the way Linux drivers work, you’ll need to re-install the drivers the next time your system updates to a new kernel. This is a pain, and is the reason I was hoping the built-in drivers or RPMFusion packages would work. More on that in the next section.

Follow-Through

Rebooting: Because I had previously removed NetworkManager from my system, I had to make sure the Gnome desktop would load the NM applet. That was fixed by going to System→Preferences→Startup Applications and enabling Network Manager.

Kernel Updates: I haven’t had to do this yet, but based on experience with other Red Hat-based systems where I’ve had to use third-party drivers, here’s how to reinstall the driver the next time Fedora sends you a kernel update.

After the new kernel is installed, but before you reboot, go back to the driver folder and run the following:

  1. make clean
  2. make
  3. sudo make install (or just switch to root and run make install)
  4. sudo modprobe rt3562sta (or stay as root and just run modprobe)

That should take care of it. If you forgot to do this first (and are reading this article on another computer), just run modprobe rt3562sta (as root) after you’re done.

Update: I originally suggested rebuilding the module before rebooting, but the Makefile automatically detects the running kernel. You can manually force it to use the source from the newer kernel, but for the sake of these directions, this way is simpler.

This 18-page thread at Fedora Forum was very informative, though it did point me in a few wrong directions.

View Kelson Vibber's LinkedIn profileView Kelson Vibber's profile on LinkedIn

20 thoughts on “Setting up a Wireless Network on Linux: Ralink 3062 and Network Manager

  1. buker

    Hi Kelson,

    I just want to thank you very much. I have been fighting with my new wifi GN-531I and the drivers in my kubuntu distribution long 6 evenings/nights trying almost everything I found on internet without any success until now. Your article was the last one and the one which worked for me. I am so happy. Once again thanks and thanks to all community for such a things you do. buker

    Reply
  2. Dan

    Thanks for your post. I went through these steps on my own, before finding it, but in my case the driver crashes hard when I try to connect.
    Were you on a 32-bit or 64-bit kernel? Mine is 64. I’m debating just sending the card back to Newegg, but if you got it to work then maybe I’ll try again.

    Reply
    1. Kelson Post author

      This was on a 64-bit kernel. The process has continued to work across several kernel upgrades, so it seems to be solid, at least on Fedora.

      The biggest gotchas I ran into were (a) making sure I had *exactly* the right driver (their naming conventions don’t help there) and (b) manual config and the usual network service conflicted with NetworkManager.

      Good luck!

      Reply
      1. Dan

        Well I’m glad it worked for you. No joy for me. I tried all I could think of, and recompiled this driver about 6 times. In case it helps anybody else, my kernel was 2.6.35. Card is going back.

        Reply
  3. Donald

    This a great and easy to follow article. I had previously looked over the referenced article prior to ordering my ZEW1642D this week but when it arrived today I located your post and had it setup and working in a half hour. Thank you for all help!

    If you could expand on how to permanently disable the network service and some information on how to boost antenna transmit power (if possible with this card?) this would be a great one stop post.

    My problem at the moment is even though I run “service network stop” checking with “service network status” indicates that it never truly does or is being started by another service or process? I’m on the lxde spin of Fedora 13 if you can help me troubleshoot the NetworkManager and network service conflicts, though I can connect to wireless networks the link quality seems to fluctuate irratically and drop off the connection at intervals, am I correct to assume these are the symptoms of the conflict you mention?

    Reply
  4. Pingback: Wireless download speeds seems to be slow

  5. Pingback: Wifi: La frontera final — Linux & AX.25

  6. Darius

    I can tell this article is all I need to get this thing working but can you give precise ways to do the things such as when you say copy, can you give the ssh command for it?

    Specifically, #3, #5B&C #7 (i type make install, is there supposed to be a filename after?)

    Thank you!

    Reply
    1. Kelson Post author

      It’s just the standard Unix copy command:

      cp filename newlocation

      And no, the make command doesn’t need any more options added to it than are listed here.

      So the exact command lines for those steps would be:

      #3: cp rt280.bin /lib/firmware/rt2860.bin
      #5b: make
      #5c: cp RT2860STA.dat /etc/Wireless/RT2860STA/RT2860STA.dat
      #7: make install

      Reply
      1. Darius

        I encounter an error at 5B

        [root@thecodah DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217]# make
        make -C tools
        make[1]: Entering directory `/home/thecodah/Downloads/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217/tools’
        gcc -g bin2h.c -o bin2h
        make[1]: Leaving directory `/home/thecodah/Downloads/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217/tools’
        /home/thecodah/Downloads/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217/tools/bin2h
        cp -f os/linux/Makefile.6 /home/thecodah/Downloads/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217/os/linux/Makefile
        make -C /lib/modules/2.6.35.6-45.fc14.i686/build SUBDIRS=/home/thecodah/Downloads/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217/os/linux modules
        make[1]: Entering directory `/usr/src/kernels/2.6.35.6-45.fc14.i686′
        make[1]: *** No rule to make target `modules’. Stop.
        make[1]: Leaving directory `/usr/src/kernels/2.6.35.6-45.fc14.i686′
        make: *** [LINUX] Error 2

        I’m running on the latest fedora core installation. Any advice here?

        Reply
  7. Froggy

    This process worked great for me with my Zonet PCI card on LinuxMint 10 x64. I just
    followed the destructions and added ‘modprobe rt3562sta’ (without the tick marks)
    to the /etc/rc.local file to enable the card at every boot. Many thanks, I had looked long and hard for a solution.

    Reply
  8. Omegamormegil

    Thanks for the help. FYI my card didn’t actually work until I added these lines to my /etc/modprobe.d/blacklist.conf file:

    blacklist rt2800pci
    blacklist rt2x00lib
    blacklist rt2x00pci
    blacklist rt2800lib

    Now it works great!

    Reply
  9. random reader

    Just a little heads-up – in the 3.x kernel none of the above is necessary as the support for rt35xx (RT3060, RT3062 etc.) is fully functional, see here. No ra0 anymore, just ordinary wlan0.

    Reply
  10. Thailandian

    Thank you, thank you, THANK YOU!

    I was within minutes of taking my adapter back to the shop and pleading for a refund when I stumbled across your blog, after hours of fruitlessly trying different things.

    After getting the adapter installed and basically working via your hackings, I did have one problem on OpenSuse 11.4, and my solution may help others.

    Trying to set up NFS shares, I discovered that the adapter had not been assigned to a firewall interface, and it was not listed under devices in the firewall settings.

    To fix that, I had to change back to ifup temporarily, and manually install the adapter. As part of that process, it was assigned to the external zone, and fortunately, after changing back to networkmanager, it was still listed listed there, so I could set up ports for NFS.

    One question – I would actually prefer to use ifup rather than network manager for my setup, but couldn’t access the Internet after installing the adapter. Do I need different settings again in config.mk for ifup to work, or should it work with the default settings that only gave me limited control via the console?

    Thanks again.

    Reply
  11. Frank Polaski

    Thank you. After many frustrating hours of trying to get this thing to work this is the only guide that worked for me. Now my card is running perfectly. You have permission to marry any of my children or father babies with my wife.

    Reply
  12. csdlc

    This worked for me on Opensuse 11.4 32bits. Althought I ran “make” as root (if not there was an error copying some file, because of permissions) and I did not step 5C (there is no such directory in my system).

    Thank you!

    Reply
  13. Pingback: The Pain | codeboyz

  14. Pingback: Using wireless card on Linux SUSE

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>