Brief How-To – Ralink on Ubuntu Feisty
Although Ralink based wireless cards have a nice open source driver, things aren’t all rosy with them on Ubuntu 7.04, aka Feisty Fawn. This in part due to Ubuntu’s switch to using Network Manager (nm) for network connections. In theory, selecting manual configuration from nm should allow you to setup your rt2x00, t2570, rt61 or rt73 device pretty easily. Unfortunately for many, including me, this didn’t work.
Working around the problem isn’t too hard though, and that’s why I’m posting this. The good news is that the current development release of Ubuntu, Gutsy Gibbon, should make things much easier. More on that at the end.
On with the How-To:
The secure way
Create a file with a short set of commands that will get your wireless – hopefully – working.
Applications > Accessories > Terminal (don’t be scared, it’s really quite easy)
cd /etc/init.d/
gksudo gedit wireless-up
Copy and paste the following into Gedit…
#!/bin/dash
ifconfig ra0 down
iwconfig ra0 essid "your essid"
iwconfig ra0 key "your wep key if you have one"
ifconfig ra0 up
dhclient3 ra0
Then change the essid and WEP key (put s: before the key if it’s not in hex format). If you use WPA, check the Ubuntu wiki for what needs to be different, shouldn’t be much.
Save the file as wireless-up. Now, you make the file executable and just make a link to that file in the initialisation scripts that run during boot up.
sudo chmod o+x ./wireless-up
cd /etc/rc2.d/
sudo ln -s /etc/init.d/wireless-up ./S14wireless-up
Now you could just reboot, but entering ‘sudo /etc/init.d/networking restart’ should apply the changes without doing that. Ahh, the beauty of Linux. If your card picks up an IP address and gives you access to the internet, the procedure has worked and you can remove nm.
sudo apt-get remove network-manager network-manager-gnome
If you change encryption keys regularly, or hop between different access points, you might find editing /etc/init.d/wireless-up a little inconvenient. If so, the next section is for you.
The insecure way
This method is very dangerous and I probably shouldn’t include it. But for your sake, I have. Any command in the file below will be run at boot time. Anyone with user access could wipe your whole system or steal sensitive data, you have been warned!
Instead of creating the file /etc/init.d/wireless-up, you can create the file in your home directory so that it’s quick to edit any time you want, without the command line.
Alt+F2 > gedit > paste the commands in…
#!/bin/dash
ifconfig ra0 down
iwconfig ra0 essid "your essid"
iwconfig ra0 key "your wep key if you have one"
ifconfig ra0 up
dhclient3 ra0
Save the file as .wireless-up in /home/yourusername/
The . makes it hidden, Ctrl+H in the file manager to show the hidden files when you need to.
Then create the link using the terminal.
cd /etc/rc2.d/
sudo ln -s /home/yourusername/.wireless-up ./S14wireless-up
To change your essid or encryption key, show hidden files in the file manager, right-click on .wireless-up > open with Text Editor.
I really recommend the first method, it’s still simple to make changes through the terminal.
gksudo gedit /etc/init.d/wireless-up
or
sudo nano /etc/init.d/wireless-up
Ctrl+O, Crtl+X
Hope that helps a few people.
Credit goes to David Gerard in an Ubuntuforums thread
Back to Gutsy Gibbon. As of Tribe 2 (2nd alpha) the Ralink devices don’t work out of the box, but that was due to a simple mistake due to be corrected. This gave me a chance to try downloading the new driver and installing it myself. From within a Live-CD session I was quickly and easily able to install the new driver (that should be in Gutsy soon) and connect to my wireless network…using Network Manager!
Things are looking up.








July 6th, 2007 at 15:39
Hey Mattyv,
Thanks a lot, your posts on the Ubuntu forums and this writeup really helped me out!
Just to let you know, in order for your startup script to work, I had to do a “chmod +x” on the wireless-up file in /etc/init.d. After I did that it all works smooth as silk. :D
July 6th, 2007 at 15:52
Thanks for the correction Lee, I have added it already. I originally did the process in April, that part completely slipped my mind.
Glad you found the post helpful,
Matt
August 12th, 2007 at 09:07
I needed a couple of changes, since I’m using a static IP:
1) exclude the dhclient3 ra0 command
2) add: route add -net 0.0.0.0 gw 192.168.1.1 ra0
(my router is at 192.168.1.1 – change if different)
HTH
October 24th, 2007 at 19:53
Hi, thanks so much for this, I have a few questions.
Do you know if this is the cause of the
~~~~~~~~~~~~~~~~~~~~~
No DHCPOFFERS received.
No working leases in persistent database – sleeping.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
errors I get when I try dhclient ra0 in the terminal?
And, is it completely necessary to uninstall gnome network manager?
Thanks.
October 24th, 2007 at 20:03
Hi David,
I can’t say for sure whether it’s the cause of your errors. What I do know is that dhclient won’t be successful unless you bring the interface down before setting the essid. So, I expect the errors will disappear.
I think you can leave Network Manager, but it won’t be able to control your wireless connection in any way because that version of NM and the Ralink driver are incompatible.
October 24th, 2007 at 23:50
Thanks for the swift reply.
I’m getting this after the “sudo /etc/init.d/networking restart” command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
david@david-desktop:/etc/rc2.d$ sudo /etc/init.d/networking restart
* Reconfiguring network interfaces… eth0: ERROR while getting interface flags: No such device
There is already a pid file /var/run/dhclient.eth0.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth0.
eth1: ERROR while getting interface flags: No such device
There is already a pid file /var/run/dhclient.eth1.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
SIOCSIFADDR: No such device
eth1: ERROR while getting interface flags: No such device
eth1: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth1.
eth2: ERROR while getting interface flags: No such device
There is already a pid file /var/run/dhclient.eth2.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
SIOCSIFADDR: No such device
eth2: ERROR while getting interface flags: No such device
eth2: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth2.
ath0: ERROR while getting interface flags: No such device
There is already a pid file /var/run/dhclient.ath0.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
SIOCSIFADDR: No such device
ath0: ERROR while getting interface flags: No such device
ath0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up ath0.
wlan0: ERROR while getting interface flags: No such device
There is already a pid file /var/run/dhclient.wlan0.pid with pid 134993416
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
SIOCSIFADDR: No such device
wlan0: ERROR while getting interface flags: No such device
wlan0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up wlan0.
[ OK ]
david@david-desktop:/etc/rc2.d$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What exactly am I doing wrong? I’ve restarted the computer aswell, it isn’t connecting. (Just for the record, I’ve left gnome network manager…would it be wise to remove it?)