LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Ralink wireless unable to connect (https://www.linuxquestions.org/questions/linux-wireless-networking-41/ralink-wireless-unable-to-connect-660355/)

s4lt1n3 08-04-2008 09:27 AM

Ralink wireless unable to connect
 
I have been reading forums for about a week and am now convinced I have tried every option I've read about. Please help! I have put so much work into this with no results!!

Using:
Ubuntu 8.04 Hardy (somewhat new to linux)

I have: Zonet ZEW2500P USB Wireless Adapater, which I read uses the Ralink chipset, which I read uses the RT73 driver. I previously used ndiswrapper to create the RT2500usb driver from the manufacturer's install disk, and had wireless + WPA working flawlessly, several months ago. About a week ago the need came up again to use wireless and it is no longer working. I removed all the other drivers I had downloaded / created with ndiswrapper in my attempts to get this working, so I don't know exactly which one worked before. It think it was either RT2500usb or RT2x00usb.

I am completely able to scan wireless networks. I am unable to connect to any [edit-during the course of this post I had minor success-keep reading]. I tried turning off WPA on my router and all the utilities I tried report that I am able to connect to my wireless network, but I am unable to ping or load websites. With WPA on I am unable to get a DHCP lease.

I first noticed issues connecting trying to connect to a non-broadcast SSID with WPA and a static IP. In researching how to do that, I found I was no longer able to connect to any wireless network. This is frustrating to the point of reinstalling windows, especially because this worked fine a month ago and I haven't touched any settings since then. I have spent probably 20+ hours trying everything I found on forums with absolutely zero results.

At this point I have removed drivers from ndiswrapper and uninstalled it, because I have RT73 installed and I have read there could be conflicts (although it was using the ndiswrapper drivers that this worked before).

I have also uninstalled the network-manager (gnome & KDE - I have both) applications because I read on various posts that they are unable to properly handle several key features. (I have seen that said about static IPs, WPA, unencrypted networks, and more!)

My wireless interface is rausb0 instead of wlan0 because of some guide I followed to get the ralink card working. Unfortunately I don't recall what it was or how that happened.

I have tried a bunch of different configurations in wpa_supplicant (such as detailed on http://ubuntuforums.org/showthread.php?t=571188) with an equal amount of success.

[Edit: Just now I was successfully able to connect using the non wpa_supplicant command line instructions for Ra based chipsets on that site when I set my router to WPA and not WPA2, or WPA/WPA2, which I had previously run my router on. This is disappointing to me because I would prefer WPA2 and I still am unable to connect using any utilities.
Quote:

sudo ifconfig <interface> down
sudo dhclient -r <interface>
sudo ifconfig <interface> up
sudo iwconfig <inteface> essid "ESSID_IN_QUOTES"
sudo iwpriv <interface> set AuthMode=WPAPSK
sudo iwpriv <interface> set EncrypType=TKIP
sudo iwpriv <interface> set WPAPSK="YOUR_WPA_PSK_KEY"
sudo dhclient <interface>
]

One question I have is how to reload wpa_supplicant.conf?? When I run wifi-radar from the terminal, there is obviously some problem loading the wpa_supplicant.conf file, because it appears to be sending my psk to iwconfig with some kind of incorrect syntax (see 2nd line of running wifi-radar). (And yes, I actually have a psk and essid set in the configs, I edit them out here) I assume that running /etc/init.d/network restart does not do this because even after deleting that line from the config file running wifi radar still produced that message. I couldn't figure out how to use the wpa_supplicant or wpa_cli command line tools. Running always produces "Could not connect to wpa_supplicant - re-trying" or some similar message, depending on what commands I try to run.

I believe I probably just have information or syntax in a config file somewhere wrong but I don't know what.

Here is information that may be relevant:
======================
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0d:9d:84:b6:af
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1492 Metric:1
RX packets:78228 errors:0 dropped:106 overruns:0 frame:0
TX packets:71416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:71024701 (67.7 MB) TX bytes:12061567 (11.5 MB)
Interrupt:10 Base address:0xa000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:79 errors:0 dropped:0 overruns:0 frame:0
TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7128 (6.9 KB) TX bytes:7128 (6.9 KB)
=====================
$ iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

rausb0 RT73 WLAN ESSID:off/any Nickname:"MYESSID"
Mode:Auto Frequency=2.412 GHz
RTS thr:off Fragment thr:off
Link Quality=85/100 Signal level:-54 dBm Noise level:-115 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
======================
Contents of /etc/network/interfaces:

auto lo
iface lo inet loopback
#address 127.0.0.1
#netmask 255.0.0.0

#iface rausb0 inet static
#pre-up ifconfig rausb0 up
#wireless-essid MYESSID
#wpa-psk KEY
#wpa-key-mgmt WPA-PSK
#wpa-proto WPA
#wpa-ssid MYESSID
#wireless-key s:KEY
#address xx.xx.xx.xx
#netmask xx.xx.xx.xx
#gateway xx.xx.xx.xx
#auto rausb0
==================
The commented out section above was from when I was trying to connect to the static IP, non-broadcast WPA network. I have read that to use network managers you must have nothing in /etc/network/interfaces except the two lines I have left uncommented.

================
Contents of /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_suppliant
ap_scan=1
network={
ssid="MYESSID"
scan_ssid=1
key_mgmt=WPA-PSK
#psk=MY_PSK_IN_HEX
}


====================
$ sudo wifi-radar
dhclient3 --version 2>&1
iwconfig: unknown command "MYPSK"
There is already a pid file /var/run/dhclient.eth1.pid with pid 134519072
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on LPF/rausb0/00:e0:4c:18:cc:ee
Listening on LPF/eth0/00:0d:9d:84:b6:af
Sending on LPF/eth0/00:0d:9d:84:b6:af
Sending on Socket/fallback
Stale pid file. Removing
Stale pid file. Removing
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

ioctl[SIOCSIWPMKSA]: Network is down
ioctl[SIOCSIWMODE]: Network is down
Could not configure driver to use managed mode
Listening on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on Socket/fallback
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 1
No DHCPOFFERS received.
Unable to obtain a lease on first try. Exiting.
======================

Running wlassistant:

$ sudo wlassistant
Loaded application options.
All interfaces: eth0, rausb0
Wireless interface(s): rausb0
Permissions checked.
DHCP Client: dhclient
All executables found.
scan: /sbin/iwlist rausb0 scan
Networks found: 3
ACTION: CONNECT.
Running DHCP client found.
kill_dhcp: /sbin/dhclient -r rausb0
==>stderr: There is already a pid file /var/run/dhclient.pid with pid 134519072
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on Socket/fallback
DHCPRELEASE on rausb0 to 192.168.2.1 port 67
No pre-connection command specified.
iwconfig_set: /sbin/iwconfig rausb0 mode managed channel 1 key restricted xxxxxxxxxx essid this
iwconfig_ap: /sbin/iwconfig rausb0 ap 00:17:3F:EF:4F:4A
ifconfig_dhcp: /sbin/dhclient rausb0
==>stderr: There is already a pid file /var/run/dhclient.pid with pid 134519072
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on Socket/fallback
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on rausb0 to 255.255.255.255 port 67 interval 11
Running DHCP client found.
kill_dhcp: /sbin/dhclient -r rausb0
==>stderr: There is already a pid file /var/run/dhclient.pid with pid 134519072
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on LPF/rausb0/00:e0:4c:18:cc:ee
Sending on Socket/fallback
DHCPRELEASE on rausb0 to 192.168.2.1 port 67
CONNECTION FAILED.
disconnect: /sbin/iwconfig rausb0 mode managed key off ap off essid off
Application options saved.
Kernel socket closed.
==========================

kwifimanager is able to scan networks but detects my WPA network as WEP and does not give me the option to connect to it. The mode and quality columns after scanning are blank and the "switch to network" button is greyed out.

=========

rutilt used to detect networks but report WEP instead of WPA and fail to connect, but at some point during all of this it started popping up this error message:

Critical error :
Data parsing error (1).
Code : -41

It pops up this message on startup and when I click "scan" on the site survey tab. After I click OK on the popup the second time the application exits with no additional information on the terminal.

===============

I have also tried wicd, with similar results.

wernerz 08-04-2008 11:23 AM

Try to find with apt-get or synaptic for "firmware-ralink". Make sure non-free in in the /etc/apt/sources.lst. It was the only way I got my card to work.

http://forums.debian.net/viewtopic.p...705&highlight=

fair_is_fair 08-04-2008 11:23 AM

Your post is somewhat long and convoluted. I can make a couple of suggestions/comments.

You need to blacklist the linux kernel drivers(/etc/modules) if you want to use ndiswrapper successfully. The operating system will most always try to load kernel modules first and you can end up with both loading and nothing working.

Did you mean rt2501 drivers instead of rt2500? Rt 2500 drivers do not include rt73 support.

Ralink updated linux rt73(rt2501) drivers last May and may not be incorporated into new kernels as yet.

Ubuntu is not ndiswrapper/wpa friendly or easy. So, good luck.

s4lt1n3 08-04-2008 12:22 PM

Thank you for the replies.

fair_is_fair
Sorry for the convolued post - I know it's long but I have read a lot of threads that were mostly people replying back and forth posting the information I included, and I already tried a bunch of stuff so I figured I'd save people the hassle (and I type a lot). For future readers: the top of my post is a description of the process I went through, and the last half or so is copied output from various commands that may help figure things out.

I am currently using RT73. I know it works because I can, through the command line as described in original post, connect to my wireless network. AFAIK it's not a problem with ndiswrapper, which I am not trying to use now. Before when I got this working I used ndiswrapper to make drivers of rt2500 from my manufacturer's disk. I have blacklisted all the other drivers I tried previously that I can't get to work now:
section of /etc/modprobe.d/blacklist
Quote:

blacklist rt2400
blacklist rt2400pci
blacklist rt2570
blacklist rt2500
blacklist rt2500usb
blacklist rt2500pci
blacklist rt2x00
blacklist rt2x00lib
blacklist rt2x00pci
blacklist rt2x00usb
blacklist rt73usb
(rt73usb as opposed to rt73 is some kind of beta or previous driver that is not supposed to be as compatible as say rt2500usb)
Also, I have read that Ubuntu 8.04 is supposed to have native support for Ralink chipset.

wernerz:
I will try that and post my results.
Edit: No, I think I already have that:

Quote:

ls /lib/firmware/2.6.24-19-generic/rt
rt2561.bin rt2561s.bin rt2661.bin rt73.bin
Is it possible the other rt bin files there could be conflicting? The RT73 module should know how to read rt73.bin right?

I have rt73 loaded:

Quote:

$ lsmod | grep rt
snd_rtctimer 4640 1
rt73 240012 1
snd_timer 24836 3 snd_rtctimer,snd_pcm,snd_seq
parport_pc 36260 1
parport 37832 3 ppdev,lp,parport_pc
snd 56996 16 snd_rtctimer,snd_ali5451,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_dummy,snd_seq_oss, snd_rawmidi,snd_seq,snd_timer,snd_seq_device
agpgart 34760 2 drm,ati_agp
usbcore 146028 3 rt73,ohci_hcd


fair_is_fair 08-04-2008 01:28 PM

I know what you are going through. I am a Ralink user. It sounds like you have a good handle on this.

I should have added that the legacy drivers and serialmonkey drivers are not that great. I have never connected rt2500usb to a wpa connection with the ralink drivers. I cannot really comment on the rt73 and wpa. I can connect with the serialmonkey drivers but it connects/disconnects constantly.

If you are bound and determined to use legacy/serialmonkey drivers try the newest build at the serialmonkey site or try the ralink updated drivers of May 008.

I find it much easier to use ndiswrapper. My wireless works flawlessly.

Could a kernel update somewhere along the line caused you to lose your ndiswrapper configuration? If ndiswrapper no longer works this is likely the cause.

You could also try another live cd distro just for testing. Something like Puppy 4.0 has terrific wireless support. The network wizard will allow you to try various drivers in a gui setting. Once you find what works, you could try to tweak your Ubuntu install. Puppy is only a 90 mb download.

s4lt1n3 08-04-2008 04:48 PM

Quote:

If you are bound and determined to use legacy/serialmonkey drivers try the newest build at the serialmonkey site or try the ralink updated drivers of May 008.
I don't care what drivers I use; I just want it to work. I think I am using the May 08 Ralink drivers right now for RT73.

Quote:

Could a kernel update somewhere along the line caused you to lose your ndiswrapper configuration? If ndiswrapper no longer works this is likely the cause.
Very likely. I installed with 6.xx, updated to 7.10, updated to 8.04. Pretty sure I last got wireless working before 8.04.

When I get home I'll uninstall RT73 and try reinstalling ndiswrapper with my manufacturer's disk driver.

s4lt1n3 08-05-2008 06:41 PM

Ok. I've got it working now. This is a detailed description of all the steps I followed to success, because by the end I was convinced it wasn't going to happen.

For future headachers: there are THREE THINGS you need to know to get this working:

1) KEVDOG KEVDOG KEVDOG
kevdog is a user who posts on the Ubuntuforums. I would say that 95% of everything I read that contained useful or helpful information were posts where he was responding on threads trying to help people. I think I'm going to send him a thank you card. In 99% of cases I bet you could get this working just by reading all his posts.

2) You need to use the correct driver! Although they are no doubt very similar only ONE of all the Ralink drivers actually works for me!

3) wpa_supplicant needs to be up and running!! (Note that I could not connect even to non-authenticated networks before this, probably due to configuration problems beyond my understanding) The other programs I used to try to connect were supposed to running wpa_supplicant but they did not!
This command ended an entire week's worth of headache:

wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -dd

sudo dhclient wlan0


Detailed steps:

1)
Getting the correct drivers:

For others with this card (which btw aside from the Ubuntu problems I do recommend), be aware that the disk contains a windows installer which must be run before you have access to the drivers on the disk, so you must have access to a Windows installation or emulator. I ran the installer in Wine and it crashed out halfway through, looked like it kept installing, but didn't actually copy the driver files anywhere. I used Sun's VirtualBox to complete an actual installation, and the driver files went in C:\Program Files\RALINK\RT7x Wireless LAN Card\Installer\WINXP\. I copied the whole Ralink folder to my Ubuntu installation using smb networking (I never got the VirtualBox shared folders working for some reason but I can network Ubuntu to the virtual XP) and used a nifty utility called ndisgtk to make a driver for ndiswrapper out of the windows driver. Be aware that ndisgtk is just a front-end for ndiswrapper tools; when I had my wireless working before I used CLI (command line interface) to create drivers with ndiswrapper, so if you want to go that route read some documentation on ndiswrapper.


2)
My hardware and required driver:

I have a Zonet ZEW2500P external USB adapter, which uses the Ralink chipset. The driver that works for me is rt73, which is widely available I believe from the serialmonkey site or Ralink support. Also I have my manufacturer's disk from buying that card, which as rt2500usb and rt73 on it (possibly others). When I had wireless working before, I thought I had used rt2500usb, but when I load the rt73 modules it recognizes my USB card and it doesn't with any other driver. I will explain more about this below.


3)
Blacklist modules

I blacklisted all of my rtxx drivers in /etc/modprobe.d/blacklist:

blacklist ipv6
blacklist rt2400
blacklist rt2400pci
blacklist rt2570
blacklist rt2500
blacklist rt2500usb
blacklist rt2500pci
blacklist rt2x00
blacklist rt2x00lib
blacklist rt2x00pci
blacklist rt2x00usb
blacklist rt73usb
blacklist rt73
blacklist b43legacy
blacklist bcm43xx
blacklist b44
blacklist ssb

The b43legacy and below is from before, when I decided it was a good idea to install Broadcom wireless chipset stuff also, because Ubuntu seems to detect that I have onboard Broadcom wireless even though I don't, so I installed to see if I did and didn't know it or something. All that did was confuse things and when I had my actual Wireless adapter plugged in it would recognize two copies of each wireless network, one from my actual adapter and one from the Broadcom adapter it thought it had.

Blacklisting ipv6 makes your internet connection run much faster unless you actually use ipv6 ;) Google this for more info

IMORTANT Note I am 99% sure the actual rt73 module would work for me just as well as the one I load with ndiswrapper. A process of elimination helped me determine which drive I actually needed, although there are other ways to obtain this information, and I got identical results using the rt73 module as with the ndiswrapper rt73, I just didn't figure out how to get the rest of it working until I had already blacklisted rt73 and used ndiswrapper.

You will see reports that you need to reboot after modifying the blacklist file; that is sort of true. The blacklist file controls what modules are loaded on startup. You can still add and remove modules just fine while running. I just updated my blacklist file every time I added or removed modules to test stuff out, so that blacklist was in sync with what I was actually doing, so I wouldn't get confused if I did reboot.

4)
Unload all other modules that might affect things!!
Look at the list of drivers you have blacklisted and remove them all:

sudo modprobe -r moduleName

I believe you can also insert and remove modules with insmdo and rmmod. I have no idea what the difference is between that and modprobe.
To know if you have modules loaded that you need to unload, run

lsmod | grep moduleName

If you are using ndiswrapper, you do NOT want any rtxx modules loaded because ndiswrapper has them. So do: lsmod | grep rt and if there are any other ralink related modules, remove them. Note that modules have dependencies so you may have to remove other modules first, for example, when I had rt2500usb loaded, it would also load rt2x00lib and I think one other one. I couldn't remove rt2x00 lib because rt2500usb was running and depended on it (although when I removed rt2500usb it automatically removed rt2x00lib). Newbie note: removing modules doesn't take them off your system, it just unloads them.

If you really can't get all the modules unloaded, make sure they're blacklisted and reboot your system. I found that modules I had blacklisted WOULD still load if I had not blacklisted another module that loaded & depended on it, hence all the b43, b44 stuff being blacklisted.

Also, to see what a module actually depends on, run
modprobe --show-depends moduleName (it will list itself there too)


5)
Make sure that ndiswrapper has the correct drivers loaded:


$ ndiswrapper -l
rt73 : driver installed
device (148F:2573) present (alternate driver: rt2500usb)

I see that it says rt2500usb is an alternative driver (it is still loaded on my system). This is the driver I thought I had gotten working before. I know that rt73 is the correct driver for my device because running lsusb, which lists usb devices connected my computer, shows:
$ lsusb
Bus 001 Device 002: ID 148f:2573 Ralink Technology, Corp.
Bus 001 Device 001: ID 0000:0000

See the 2573? I think that indicates I need to rt73 driver. Als, I bet if I were to google 148f I may find lists of device IDs and drivers that would indicate the same.

On my computer I also have the modules usbcore and ohci_hcd loaded. I don't know what these are for but I think this is standard, so if you are having problems and don't have these it may be a cause. Check:
$ lsmod | grep ndis
ndiswrapper 192920 0
usbcore 146028 3 ndiswrapper,ohci_hcd

If you had any other rt modules loaded while ndiswrapper was loaded, you probably need to unload ndiswrapper after unloading the others, then load it back up. I say this because I assume if there are multiple conflicting drivers present, when ndiswrapper loads and the driver attempts to connect to your card, it probably won't succeed.

Run dmesg to see if your wireless card it recognized correctly:
$dmesg
-----------a lot of other stuff, just look at the bottom of the output--------
[ 132.515635] eth0: Setting full-duplex based on negotiated link capability.
[ 2396.406193] usb 1-2: new full speed USB device using ohci_hcd and address 2
[ 2396.754903] usb 1-2: configuration #1 chosen from 1 choice
[ 2397.245039] usb 1-2: reset full speed USB device using ohci_hcd and address 2
[ 2397.554008] ndiswrapper: driver rt73 (Ralink,03/08/2006, 1.00.05.0000) loaded
[ 2399.789134] wlan0: ethernet device 00:e0:4c:18:cc:ee using NDIS driver: rt73, version: 0x0, NDIS version: 0x500, vendor: 'IEEE 802.11g Wireless Card.', 148F:2573.F.conf
[ 2399.795708] wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK

Also, viewing the system log file at /var/log/syslog can be helpful. I would recommend loading this in a GUI text editor (I use kate), not command line like nano, because it's HUGE. The bottom of the file contains newest entries. Among all the "warning: not loaded blacklisted module..." entries it says:
[ 2397.245039] usb 1-2: reset full speed USB device using ohci_hcd and address 2
[ 2397.554008] ndiswrapper: driver rt73 (Ralink,03/08/2006, 1.00.05.0000) loaded


I think that I have programs on my system that are still trying to load all the rt modules I blacklisted, and that is why I have about a hundred "not loading blacklisted module rt73" and "not loading blacklisted module rt2500usb" lines. I assume it would be more efficient to stop the system from trying to load those, so if anyone knows how to find out what programs are doing that and turn them off, let me know.

[Edit: I fixed this. Skip to the bottom of this edit for the fix; I am going to explain it here. Open the /etc/udev/rules.d/ directory. In here should be a a file ending in "modprobe.rules". On mine it is /etc/udev/rules.d/90-modprobe.rules. Towards the end is a section that says "load drivers that match kernel-supplied alias." I don't know anything about aliasing, but I remembered that at some point during this whole process some program made aliases for my wireless connection, such as rausb0 or ra0 instead of wlan0. This was in the file /etc/modprobe.d/ralink. This file contained:

alias wlan* rt2500usb
alias ra0 rt2500
alias rausb0 rt2570

which are the modules the system log said it kept trying to load. I simply (backed up this file and) erased the contents of it. I rebooted my machine to see if it still tried to load those modules and bingo, it did not. Note the first time I rebooted after this the system froze after it finished loading everything, before it entered the login manager. I rebooted again and have not had this problem since. I think you could probably safely just delete the ralink file. I recommend always making backups when messing with config / system files.
END EDIT]

At this point you should be able to run
iwlist wlan0 scan
and see wireless networks even if you cannot connect to them. (If you can, lucky you). All the wireless utilities I tried would show wireless networks but would fail to connect with WPA on. If WPA is off, they would report a successful connection but still wouldn't be able to connect. Running sudo dhclient wlan0 now would time out waiting for DHCPOFFER.


6)
Setting up /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf

I believe at the time I got this working my /etc/network/interfaces contained only:

auto lo
iface lo inet loopback
iface wlan0 inet dhcp
auto eth0
auto wlan0
wireless-mode managed
wireless-essid any

I don't think the last two lines are necessary for this to work.

/etc/wpa_supplicant/wpa_supplicant.conf contains:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=myGroup
ap_scan=1
network={
ssid="mySSid"
key_mgmt=WPA-PSK
psk="myAsciiPSK"
}

# associate with any access point
network={
key_mgmt=NONE
}

I recommend setting a group so that wpa_supplicant doesn't need root / admin privileges every time it wants to do something. I haven't actually tested this yet but it should work. In KDE I have a user manager, Kuser (I think). It is in my Systems list off the menu, from my KDE4 installation (I switched back to KDE3 cuz 4 blows).
I have my network info tabbed over for spacing (which I can't enter in here) but I don't think that affects the config file in any way.

You probably need to restart your networking to reload /etc/networking/information. I don't know exactly how to do this other than restarting your computer, but I think one or both of these commands might do it:

/etc/init.d/networking restart
/etc/init.d/dbus restart

You probably need to sudo those. A lot of system services use dbus, so I don't think it's a good thing to do. You could probably google and find the exact command to reload interfaces.


7)
Load wpa_supplicant:

wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -dd

sudo dhclient wlan0

-D is for the driver to load. For some reason I had to use wext even though I am using ndiswrapper to load rt73. -i is the interface I use for my wireless, wlan0. A lot of people have their wireless on eth1 so you may need to change this. -c is the wpa supplicant config file, usually at /etc/wpa_supplicant/wpa_supplicant.conf. The -dd is for extended debugging information.

This command is usually run by other programs. From what I've read wpa_supplicant is supposed to have front-end programs that do all these things for you. One of the main problems I had is that this did not occur; that is why I was able to connect on the command line by using iwconfig and iwpriv to set my essid and psk and everything, but I still couldn't connect with any wireless manager utility.

After running the command in a shell I had to enter

sudo dhclient wlan0

to get a DHCP lease from the router. As for static IPs in this situation...I have no idea, other than that after I entered the wpa_supplicant command, my utilities were able to manage my connection, and wicd (among others) has options for static IP, so I guess that would do it. I'll find out anyway because I have to connect to a non-broadcast static IP network soon. I'll post here if I get it working. You could probably enter in your static IP information into /etc/networking/interfaces also. Google for how to do that.

Also note: during the process of doing all this, I uninstalled network managers and my wired connection no longer auto connected. To connect to your wired (assuming you're like me and have that luxury while trying to get wireless to work), do: (eth0 is my wired interfaces)

sudo ifconfig eth0 up
sudo dhclient eth0

8)
Now what?

I don't want to have to connect manually to wireless every time I want to get online. Why can't it be like windows, where all I have to do is turn my computer on, and if there's a wired connection, use that, otherwise connected to the fastest wireless network that's available? Well, there are a few options for this. One would be to write a startup script that automatically tries to connect to wired, and if that fails, runs an iwlist wlan0 scan and then tries to connect to all of those. I don't know how to do that.

I read that putting
wpa-driver wext
in /etc/network/interfaces should make it automatically use wpa_supplicant. I put that line in mine after "iface wlan0 inet dhcp".

I read about (and installed but haven't used) a utility called ifplugd, a daemon that is supposed to do exactly what I'm asking for. I followed this guide
http://ubuntuforums.org/showthread.php?t=43766
and also installed the latest wicd that is supposed to be able to do the same thing, stable wicd-1.5.1 from http://www.wicd.net/latest (I read the latest is a lot better than repo version).
I also read http://wicd.net/punbb/viewtopic.php?pid=373
and ran
sudo update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
which is supposed to make wicd not ask for your password every time the computer boots up.

I have not tested most of the stuff in Section 8 here. I have just done it and I will see how it works. Wicd did automatically connect to my wired when I booted, although I didn't have my Wireless plugged in, but any number of network managers do that. I think a lot of them can probably automate this process and there's probably other scripts that can be run. The important part is that I got wireless with WPA working finally, after a week's worth of hassle. The main problem is that wpa_supplicant was not automatically started by other programs when I think it was supposed to be. I don't know why this was, and I don't know why I still couldn't connect to unsecure networks when wpa_supplicant wasn't loaded.

Good luck.

[EDIT: The above configuration does seem to work. The system automatically connects to my wired network, and is able to connect wirelessly without me explicitly loading wpa_supplicant. It is not automatically connecting to wireless networks if there isn't a wired connection present, which I think may be due to something with wicd. I am researching that now.]
[The most likely reason I have found is that the system may take longer to register the wireless adapter than wicd takes to run its autoconnect logic on startup. However that is too far beyond the scope of my original topic for me to cover here.]


All times are GMT -5. The time now is 01:58 PM.