# wpa_state=COMPLETED but still no ip on wlan0

## greanie

I have been trying to get my wireless adapter to connect to my network.  I have a Ralink 2571W wireless adapter that apparently works with the RT73USB driver.

> lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null

Bus 001 Device 003: ID 18e8:6238 Qcom

  bDeviceClass            0 (Defined at Interface level)

  bDeviceProtocol         0

  iProduct                2 802.11 bg WLAN

      (Bus Powered)

  bDeviceClass            0 (Defined at Interface level)

  bDeviceProtocol         0

  (Bus Powered)

> lsmod | grep rt

rt73usb                23301  0

rt2x00usb               7687  1 rt73usb

rt2x00lib              32433  2 rt73usb,rt2x00usb

crc_itu_t               1056  1 rt73usb

I have build the appropriate wireless modules using menuconfig:

> find /lib/modules/3.7.10-gentoo/ -type f -iname '*.ko' | grep wireless

/lib/modules/3.7.10-gentoo/kernel/drivers/net/wireless/rt2x00/rt2x00usb.ko

/lib/modules/3.7.10-gentoo/kernel/drivers/net/wireless/rt2x00/rt73usb.ko

/lib/modules/3.7.10-gentoo/kernel/drivers/net/wireless/rt2x00/rt2x00lib.ko

/lib/modules/3.7.10-gentoo/kernel/drivers/net/wireless/rt2x00/rt2800lib.ko

/lib/modules/3.7.10-gentoo/kernel/drivers/net/wireless/rt2x00/rt2800usb.ko

> ls -la /lib/firmware/

total 12

drwxr-xr-x  2 root root 4096 Mar 12 16:53 .

drwxr-xr-x 10 root root 4096 Mar 12 17:10 ..

-rw-r--r--  1 root root 2048 Mar 12 16:52 rt73.bin

Contents of /etc/conf.d/net:

config_eth0="192.168.1.205 netmask 255.255.255.0 brd 192.168.1.255"

routes_eth0="default via 192.168.1.1"

modules_wlan0=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -f /var/log/wpa_supplicant.log -dd"

wpa_timeout_wlan0=15

config_wlan0="dhcp"

Contents of /etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=1

# Let wpa_supplicant take care of scanning and AP selection

#ap_scan=1

# Chalet La Vire, av. de la Gare 2, 1882 Gryon

network={

        ssid="my-ssid"

        psk="private-key"

        priority=5

}

After getting the parameters wrong a few times, I finally got wpa_cli stat says I am connected

> wpa_cli stat

Selected interface 'wlan0'

bssid=00:24:93:60:e0:00

ssid=my-ssid

id=0

mode=station

pairwise_cipher=CCMP

group_cipher=TKIP

key_mgmt=WPA2-PSK

wpa_state=COMPLETED

The wpa_state isn't always that stable during boot up.  The wpa_state may say COMPLETED and when I try it a few seconds later, I get:

> wpa_cli stat

Selected interface 'wlan0'

bssid=00:24:93:60:e0:00

ssid=my-ssid

id=0

mode=station

pairwise_cipher=CCMP

group_cipher=TKIP

key_mgmt=WPA2-PSK

wpa_state=4WAY_HANDSHAKE

However, even when it seems stable on COMPLETED, I can't get an ip address.

>  ifconfig wlan0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::20d:f0ff:fe5a:e4ee  prefixlen 64  scopeid 0x20<link>

        ether 00:0d:f0:5a:e4:ee  txqueuelen 1000  (Ethernet)

        RX packets 19334  bytes 5620278 (5.3 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 26293  bytes 5367695 (5.1 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

> dhcpcd wlan0

dhcpcd[26932]: dhcpcd already running on pid 26866 (/var/run/dhcpcd-wlan0.pid)

Any idea what I have missed? Why doesn't it get an ip address?  Is there a way to see which state the dhcpcd request is at?

----------

## DONAHUE

rc-update show | grep -i dhcpcddhcpcd[/code] if you have dhcpcd in a runlevel get rid of it 

```
rc-update del dhcpcd
```

 

```
/etc/init.d/net.wlan0 stop

/etc/init.d/dhcpcd stop 

/etc/init.d/wlan0 restart
```

 If the situation is unchanged and assuming wext driver is in your kernel  *Quote:*   

> [*] Networking support  --->
> 
> -*-   Wireless  --->
> 
> --- Wireless                                                      
> ...

  replace *Quote:*   

>  wpa_supplicant_wlan0="-Dnl80211"

  with 

```
 wpa_supplicant_wlan0="-Dwext -dd -f /var/log/wpa_supplicant.log"
```

 nl80211 may not support your card, this will provide better logging.

wpa_supplicant.conf:

 *Quote:*   

> ctrl_interface=/var/run/wpa_supplicant
> 
> ctrl_interface_group=0
> 
> update_config=1
> ...

 

```
/etc/init.d/wlan0 restart
```

 and check the log at /var/log/wpa_supplicant.log

----------

## khayyam

 *DONAHUE wrote:*   

> 
> 
> ```
> wpa_supplicant_wlan0="-Dwext -dd -f /var/log/wpa_supplicant.log"
> ```
> ...

 

DONAHUE ... with net-wireless/wpa_supplicant-0.7.3-r5 the '-f' (file) switch is only enabled if the 'debug' useflag is set. I reported this as a bug as CONFIG_DEBUG_FILE=y does not enable debugging, but only the capacity to use the '-f' switch. The useflag has been removed from the ~arch keyworded packages, but enabling 'debug' is required to log to a file with 0.7.3-r5. I point this out as 'debug' is not eabled by default and if the OP provides '-f' as an option to 'wpa_supplicant_wlan0=' wpa_supplicant will fail to start.

greanie ... its probably as DONAHUE suggested, you have dhcpcd set to run in the default runlevel, remove it and net.wlan0 will start dhcpcd as and when the interface is brought up.

best ... khay

----------

## greanie

Thanks for your ideas and feedback!  I found my (n00b) issue.  I was working command-line while getting wpa_supplicant and I had several instances of wpa_supplicant going simultaneously.  When I tried to stop dhcp on wlan0, another would start it up again.  I finally figured it out by doing a ps -ef | grep wpa.  Once I killed the other processes, the wpa_state stablized and it was able to get an IP address!  

Also, I was able to use the nl80211 driver and did not change to the wext driver.

Thanks again for your feedback.  By trying to stop dhcpcd, I was able to find the root problem!!!

----------

