# unable to set password for wireless

## edward_scott

I have been setting up my wireless for the first time. I initially had a problem getting an interface to my wireless card, as discussed here. that problem was solved, and what I am facing now is a different problem, so I thought I would move it to its own thread.

the interface to the wireless card seems to be working, as I am able to connect to unsecured wirless networks and browse the internet just fine. I cannot get it to work with a secured network though.

I read the the gentoo documentation on wireless networking, including the part about setting up the keys in chapter 4.c. accordingly I set up my /etc/conf.d/net as follows:

 *Quote:*   

> modules=("iwconfig")
> 
> key_Flat3="[1] s:password key [1] enc open"
> 
> preferred_aps=("Flat3")
> ...

 

when I try to start /etc/init.d/net.wlan0, however, I get the following output:

 *Quote:*   

> Starting wlan0
> 
>   Configuring wireless network for wlan0
> 
>   wlan0 does not support setting keys
> ...

 

if I try it manually, I run iwconfig wlan0 essid Flat3 followed by iwconfig wlan0 key s:password. then I get the following output:

 *Quote:*   

> Error for wireless request "Set Encode" (8B2A) :
> 
>     SET failed on device wlan0 ; Invalid argument.

 

no matter how I present the argument, with or without quotes, with or without the word key, with or without enc open before/after the key argument, it always complains that my argument is invalid. I copied some of the examples in iwconfig's man page exactly and it still complained.

similarly I have tried other ways of formatting the key_Flat3 argument in my /etc/conf.d/net file. it always complains that either wlan0 does not support keys, or the parameter key_Flat3 is incorrect. 

obviously I wonder whether I for some reason do not have support for keys. (how would I tell?). but that is not the complaint when I try to set the key with iwconfig myself -- it always always complains about the argument being invalid. this confuses me greatly. when I initially encountered this problem I was running wireless-tools 1.20r1. I upgraded to 1.25, which is the latest unmasked version in portage, but the symptoms of the problem did not change. my wireless card is a linksys wireless-g pci adapter, model WMP54GS.

has anyone else encountered this problem? any help or suggestions would be greatly appreciated.

----------

## no_hope

```
Error for wireless request "Set Encode" (8B2A) :

    SET failed on device wlan0 ; Invalid argument.
```

This indeed sounds like you don't have a module loaded that is necessary for encryption. 

You probably need to load an extra module that came with the driver or enable some functionality in the kernel. dmesg should tell you what failed or is missing.

----------

## edward_scott

hm... so here are the relevant parts of dmesg after boot:

 *Quote:*   

> ndiswrapper: no version for "struct_module" found: kernel tainted.
> 
> ndiswrapper version 1.25 loaded (preempt=no,smp=yes)
> 
> ndiswrapper: driver wmp54gs (Linksys,12/22/2004, 3.100.46.0) loaded
> ...

 

and after trying to manually call 'iwconfig wlan0 key s:password':

 *Quote:*   

> ndiswrapper (add_wep_key:819): adding encryption key 1 failed (C0010015)
> 
> ndiswrapper (add_wep_key:819): adding encryption key 1 failed (C0010015)

 

I'm not sure what the 'kernel tainted' line in the first one means. honestly I don't quite know how to interpret this. if I am missing a module, how do I figure out which one?

any guidance would be greatly appreciated. in case it is helpful, here is the output of an lsmod:

 *Quote:*   

> Module                  Size  Used by
> 
> snd_seq_midi            6176  0 
> 
> snd_emu10k1_synth       5632  0 
> ...

 

----------

## no_hope

ndiswrapper is a pain.

It's probably not a missing module issue, otherwise in dmesg you should have seen an error about a missing function.

Don't worry about the "tainted kernel" message, it just means that not all code in your kernel is released under the GPL

This is a bit of a shot in the dark, but what's the output of ndiswrapper -l and iwpriv <your wireless interface>

----------

## edward_scott

ndiwswrapper -l

 *Quote:*   

> installed drivers:
> 
> wmp54gs		driver installed, hardware (14E4:4320) present

 

iwpriv wlan0

 *Quote:*   

> wlan0     Available private ioctls :
> 
>           ndis_reset       (8BF0) : set   0       & get   0      
> 
>           power_profile    (8BF1) : set   1 int   & get   0      
> ...

 

another interesting thing I noticed -- iwconfig doesn't seem to be able to set the ESSID to connect to. when I run 'iwconfig wlan0 essid Flat3' it doesn't complain or give any error, but a subsequent call to 'iwconfig wlan0' shows that the ESSID is set to None/Any. I'm sure that's the right syntax. just as I am sure I am using the right syntax to set the key, which not only fails to set the key but fails with an error.

thanks for your help so far... I'm totally up the creek at this point.

----------

## no_hope

Inability to set ssid may indicate broken ndiswrapper. Try upgrading to another version.

what's the output of

iwpriv wlan0 set_encr_mode

iwpriv wlan0 set_auth_mode

iwpriv wlan0 network_type

Also, try "ifconfig wlan0 up" after setting ssid

----------

## edward_scott

the iwpriv commands all complained: 

 *Quote:*   

> The command set_encr_mode needs exactly 1 argument(s)...

 

I tried adding arguments, but then it didn't provide any output or seem to have any effect at all.

I was preivously using ndiswrapper 1.25 and wireless-tools-28. I tried upgrading to ndiswrapper 1.30. no change. I tried upgrading to wireless-tools-29_pre10. still no change. 

I thought about switching to wpa_supplicant, but it turns out that it is dependant on severl x11 libraries that are not installed, and are being blocked by some x11 libraries that *are* installed. sorting that out without an internet connection will be a nightmare, so I passed on that option. if anyone else can help me out with wireless-tools here, I am desperately in need!

----------

## no_hope

You should be able to get around package blocking by running

```
USE="-qt3 -qt4" emerge -av wpa_supplicant
```

this should install wpa_supplicant without X support

edit: also try re-emerging ndiswrapper with debug USE flag:

```
USE="debug" emerge -av ndiswrapper
```

That may generate extra debugging info in /var/log/ and dmesgLast edited by no_hope on Sat Dec 09, 2006 1:57 pm; edited 1 time in total

----------

## no_hope

http://ndiswrapper.sourceforge.net/mediawiki/index.php/Installation has some instructions on how to set up keys. They recommend using "restricted" option. Maybe you should try that

Make sure you enter commands in the right order. I've ran into situations in the past where ssid had to be set before the card was brought up or it wouldn't associate. Stupid things like those are driver specific.

----------

## edward_scott

no luck. everything seems to work fine, except the line 'iwconfig wlan0 key restricted XXXXXXXX'. no matter how I format the argument, I always get an error about an invalid argument. the once exception, I have found, is if I try

```
iwconfig wlan0 key restricted 0123-4567-89
```

 that works without a problem, and when I then restart /etc/init.d/net.wlan0 it doesn't complain -- it tries to connect to the wireless network. It fails of course, since the key is incorrect, but still it fails.

so I am wondering, why on earth does every other call to 'iwconfig wlan0 key ...' complain about invalid arguments? even when I am copying them straight from the man page?

also, I have noticed, that when I call 'iwconfig wlan0 essid ESSID', the output of iwconfig wlan0 always says ESSID:off/any. This seems to be the same regardless of whether wlan0 is down or up.

I'll do some more research on this later on today. hopefully that will yield something.

----------

## no_hope

 *edward_scott wrote:*   

>  so I am wondering, why on earth does every other call to 'iwconfig wlan0 key ...' complain about invalid arguments? even when I am copying them straight from the man page? 

 

I believe iwconfig is just a wrapper around ioctls, a convenient way of sending commands to the driver. When you issue an iwconfig command, it just sends that info to the driver. iwconfig can only do very basic checks and probably doesn't do much enforcement in terms of format or value restrictions. In your case it is the driver that rejects the data, not iwconfig.

----------

