# wpa_gui problems

## abraxa5

I am a total linux/gentoo newb and I am having trouble connecting to my wireless network.  I am using an Realtek Semiconductor Corp. RTL8187 Wireless Adapter via usb

I am using KDE

I am using WPA2 encryption.

I can bring my wifi adapter up using ifconfig wlan0

I configured my /etc/wpa_supplicant/wpa_supplicant.conf file as follows:

```
# Allow users in the 'wheel' group to control wpa_supplicant

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

# Allow user-made changes to be saved (e.g. add networks)

update_config=1

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

#ap_scan=1

#update_config=1

network={

        ssid="GreenFlamingo"

        psk="********"

        scan_ssid=1

        eap=TLS

        proto=WPA2

        key_mgmt=WPA-PSK

        group=CCMP TKIP

        pairwise=CCMP TKIP

        priority=5

}

```

when I launch wpa_gui (as root or user) under status it says:

```
 Could not get status from wpa_supplicant
```

my /etc/conf.d/net is:

```
# This network configuration was written by net-setup

modules="wpa_supplicant"

wpa_supplicant_eth0="-rtl8187

config_wlan0="dhcp"

config_eth1="dhcp"
```

Using airodump-ng I see the following related to my network:

```
 

BSSID--CO:C1:C0:92:D6:F9 PWR--"-20  Beacons--12  #Data--1   #/s--0  CH--11 MB--54e  ENC--WPA2  AUTH--PSK  ESSID--GreenFlamingo

```

I had to manually create wpa_supplicant.conf

I have no clue where to go from here.

----------

## wrc1944

My working /etc/wpa_supplicant/wpa_supplicant.conf file looks like this.  Try adding the id_str="gentoo" line to yours.

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=1

network={

   ssid="linked-WRC"

   psk="*************************"

   proto=RSN

   key_mgmt=WPA-PSK

   pairwise=CCMP

   auth_alg=OPEN

   priority=5

   id_str="gentoo"

}

```

My working /etc/conf.d/net file looks like this.  Try adding the 2nd line to yours.

```
modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"

wpa_timeout_wlan0=30

config_wlan0="dhcp"
```

Also, I have net.lo at boot run level, and net.wlan0 at default run level.  Check yours with the rc-update show command.

EDIT: Just noticed your /etc/conf.d/net file line 2 is missing a trailing quotation mark.  If it's not just a copy/paste typo error in you forum post, fix it.

----------

## Odward

Speaking of your /etc/conf.d/net file

 *Quote:*   

> # This network configuration was written by net-setup
> 
> modules="wpa_supplicant"
> 
> wpa_supplicant_eth0="-rtl8187
> ...

 

Do you have 3 network interfaces in this box?  You've used eth0, eth1, wlan0 in this configuration

 *Quote:*   

> wpa_supplicant_eth0="-rtl8187

 

Is possibly supposed to be

```
wpa_supplicant_wlan0="-Dnl80211"
```

or possibly -Dwext

I don't think the driver in this context is meant to explicitly match the kernel module in use, and I think nl80211 is the

preferred driver - wext may be better for your card if it's older as that is the generic driver.  You can issue

```
wpa_supplicant -h
```

 to see a list of available drivers.

In your wpa_supplicant.conf you have

 *Quote:*   

> ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel 

 

listed twice uncommented.  Probably not a big deal but you don't need it twice.

----------

## wrc1944

Yeh- I'm also wondering why abraxa5 put in the actual driver module name.  The kernel should load it automatically, if it's in the kernel config as a module.

I've never had to put any adapter driver in wpa_supplicant config files.  It loads my usb realtek r8712u driver at boot.  My r8712u usb device needs additional firmware, but I'm not sure about the RTL8187 Wireless Adapter.  Wouldn't surprise me if it does.  Look in /lib/firmware, and see it you have it.  If not, that might be the main problem, assuming it does need firmware.

Also, does lsmod confirm 8187 is actually loaded?  Any clues in dmesg about what's happening when it loads?

As long as it's got 

```
modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"

wpa_timeout_wlan0=30

config_wlan0="dhcp" 
```

 in /etc/conf.d/net, and the /etc/wpa_supplicant/wpa_supplicant.conf file is correct, it should work.

----------

## Odward

Also for the purpose of troubleshooting you could do something like

```
wpa_supplicant -iwlan0 -Dnl80211,wext -c/etc/wpa_supplicant/wpa_supplicant.conf
```

This will attempt to start the wireless connection (interface wlan0), with the wpa_supplicant.conf as its configuration file

and using the first driver that is able to initialize the interface (nl80211 or wext) and it won't background.

So you can see if it works, or possibly where it's failing, on the command line.

Once it's working then you can make sure the /etc/conf.d/net is configured, and relevant symlinks in /etc/init.d/ (such as net.wlan0)

are in the proper runlevels so that it works on restarts going forward.

----------

## abraxa5

 *Odward wrote:*   

> Do you have 3 network interfaces in this box? You've used eth0, eth1, wlan0 in this configuration

 

I have 2 ethernet nics built in.  I have a built in wifi card with bluetooth as well which is the ASUS wifi-go (broadcom chipset I believe).  I am having trouble  getting linux to even see  (I can't find it on an lspci, but I didin't look hard either).  I am also using an ALFA wireless nic (supports injection).  So... I have 3 + 1 usb.  I use my usb one a lot since it supports injection and I play with Backtrack's wireless stuff sometimes on my laptop.

 *wrc1944 wrote:*   

> Yeh- I'm also wondering why abraxa5 put in the actual driver module name.  The kernel should load it automatically, if it's in the kernel config as a module.

 

Lol, because that is what I thought it was asking for.  I did compile those drivers directly into the kernel, and not into modules.  It seems to work though.

 *Quote:*   

> 
> 
> I've never had to put any adapter driver in wpa_supplicant config files.  It loads my usb realtek r8712u driver at boot.  My r8712u usb device needs additional firmware, but I'm not sure about the RTL8187 Wireless Adapter.  Wouldn't surprise me if it does.  Look in /lib/firmware, and see it you have it.  If not, that might be the main problem, assuming it does need firmware.

 

I did not have to do any kind of firmware updating of it, unless it did automaticlly when I updated world, but I don't see it doing that.

 *Quote:*   

> Also, does lsmod confirm 8187 is actually loaded?  Any clues in dmesg about what's happening when it loads?

 

No, but like I said, I compiled the drivers into the kernel.

After changing the id_str and fixing the eth0 to wlan0 (what was I thinking), it worked.  Thank you very much for your help.

ps.  This may be one of the most friendly forums I have been to.  Since gentoo has a larger learning curve then I am used to, it helps a lot.

----------

## abraxa5

Ok, so after I run wpa_supplicant -iwlan0 -Dnl80211,wext -c/etc/wpa_supplicant/wpa_supplicant.conf

wpa_gui then works, when it is running in terminal.  any idea how to get it working without running that command first?

----------

## Odward

You might test that command with -Dnl80211 or -Dwext only, unless it's apparent from the output which of the

two drivers are actually used.  Although you could probably just continue to use both and it will use the first 

one that works.  (They might both work, but you really only need either nl80211 or wext.)

Then you should just need /etc/conf.d/net to contain

```
modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dnl80211,wext"  ## If you figured out which -Dnl80211 or -Dwext would be sufficient here

config_wlan0="dhcp" 
```

Then you should have a symlink at /etc/init.d/net.wlan0 that points to /etc/init.d/net.lo

If it doesn't already exist, create it with

```
ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
```

Now you should be able to manually start wireless with

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

If you get errors stop and post them, otherwise:

If that starts and works you may need to add it to the default runlevel

```
rc-update add net.wlan0 default
```

It will now start in the default runlevel whenever you boot your computer, so you don't have to issue commands

to start it on subsequent boots.

----------

## abraxa5

When I use the command - /etc/init.d/net.wlan0 start

I get the error:

```
* Bringing up interface wlan0

 *   Starting wpa_supplicant on wlan0 ...                                                                                                                                                [ ok ]

 *   Starting wpa_cli on wlan0 ...

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

 *   start-stop-daemon: failed to start `/usr/bin/wpa_cli'                                                                                                                               [ !! ]

 * ERROR: net.wlan0 failed to start
```

I checked /usr/bin and wpa_cli is there.

In addition, when I run:

```
wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf
```

The inteface goes up, ifconfig shows wlan0 is transfering packets, but I am unable to use the internet.  Torrents won't work, nor will my web browser (including trying to connect to my router via browser)

----------

## wrc1944

abraxa5,

I don't understand why you have anything related 80211 item in your /etc/conf.d/net file (or do you still have that)? Using wpa_supplicant on many different distros and installations, I've never had to add that.

Try using exactly what I have posted above for your /etc/conf.d/net file, in other words just have the 2nd line read:

```
wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf" 
```

Check your /etc/wpa_supplicant/wpa_supplicant.conf to make sure it's correct, and check with rc-update show to see if net.wlan0 is at the default run level.

Then reboot.  If that doesn't work, please post your two current wpa related files, and the output of rc-update show.

One other thought.  You said you had your rtl8187 driver compiled into the kernel, and not as a module.  Sometimes for certain things it's better to have things as modules.  This is usually true with alsa sound, for example, and more than a few others.  In general, it's better to only compile directly into the kernel things that are absolutely needed in order to boot the machine to an operational state, such as file system support, etc., and do other things as modules where the kernel will detect and load what it finds it needs.  Of course there are exceptions.

----------

## Odward

 *wrc1944 wrote:*   

> abraxa5,
> 
> I don't understand why you have anything related 80211 item in your /etc/conf.d/net file (or do you still have that)? Using wpa_supplicant on many different distros and installations, I've never had to add that.
> 
> 

 

@wrc1944

nl80211 is just another driver for wpa_supplicant, much like wext.  From some documentation I read nl80211 is newer (I can't speak to better).

From Here.

 *Quote:*   

> nl80211 is the new 802.11 netlink interface public header. Together with cfg80211 it is intended to replace Wireless-Extensions

 

I use nl80211 on my wireless centrino card and it works flawlessly, with no mention of wext at all.  But abraxa5 got the idea from me  :) 

@abraxa5

By all means try wrc1944 suggestions too, I'm no guru.

Part of the reason it's possible you cannot surf / torrent etc. after running the command 

```
wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf
```

is that command doesn't obtain an ip address - it only establishes the wireless connection to your router.

You would need to request / assign the ip separately, in that type of manual connection, perhaps "dhcpcd wlan0"

If the /etc/init.d/net.wlan0 start had worked, it would have obtained an ip address for you because of the /etc/conf.d/net configuration.

That's what the config_wlan0="dhcp" does, but that is not parsed if you manually run wpa_supplicant

I don't have the wpa_cli configured in my wpa_supplicant.conf so I don't have an experienced answer for that.  It's related to this line in your config

```
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel 
```

If you're configuring a desktop and just need to access your home wireless router, you could consider commenting this line.  Although that's not a real solution  :D

You could also perhaps set the GROUP=root and see if the error persists, if not that might hint at a permission problem somewhere.

Also in case it needs to even be said, if you're running wpa_supplicant from the command line (manually) be sure to stop it before you attempt

/etc/init.d/net.wlan0 start

----------

## wrc1944

@Odward,

Thanks for the link- I didn't know much about the nl80211 driver, which brings up this question.  I read that the rtl8187 is not one of the latest driver/chipsets, so I'm wondering if perhaps trying to use the newer nl80211 with 8187 dependent hardware could be causing problems.

The reason I suspect this is because when kernel-3.2.x was released I started having serious problems with my usb r8712u (from kernel staging drivers) dependent adapter.  The problems consisted of not being able to consistently connect, or when it did I had constant dropping of the connection. and very weak connections.  I knew my hardware and configurations were correct, because if I used any 3.1 kernel, everything was rock solid with 100% connection quality, using wpa_supplicant, NetworkManager, or wicd.  I could even replace any 3.2 kernel's wireless r8712u source directory with any 3.1 version, and then recompile the 3.2 kernel using 3.2 r8712u source, and everything went back to being perfect.  Also, if I used other adapters, with either ralink or ath9k chips/drivers, all was well. They were already configured in the kernel as modules, so the kernel sorted it all out, and auto-loaded the appropriate driver  Obviously, this confirmed even slight changes between kernel source code versions (3.1 and 3.2) can have major impact on this kind of stuff.

I finally contacted the linux kernel's wireless driver maintainer, and wound up being one of a few r8712u adapter users who were helping test his patches, which were eventually included in the >3.3 and 3.4 mainstream kernel. This process took weeks, and many kernel re-compiles, but I learned a lot.   :Very Happy:    However, please don't take that to mean I'm even close to being an expert on this!

I basically agree with all Odward has mentioned, and here are some other thoughts:

I guess the bottom line here is that since the usual fixes don't seem to be working, I think we need to examine abraxa5's kernel config, and know what kernel version he's running.

If available, he could try another usb adapter using a different chip and driver, and see if it works with his wpa_supplicant configs. Might require configuring a module into the kernel. If a different adapter works, this would confirm if it is or isn't an rtl8187 device and/or driver problem.

In fact, he should probably re-complie his rtl8187 as a kernel module anyway. This might be one of those cases where it's better to have it as a module.

Still haven't seen if dbus is started before wlan0 in rc-update show.  That might be important.

@abraxa5'

 BTW, does "including trying to connect to my router via browser" mean you can't actually open up the router's setup config pages with your browser?

----------

## abraxa5

Ok, so I can connect to my router, and I have full internet accsess, but I have to do the following after boot:

```
/etc/init.d/wpa_supplicant start

dhcpcd wlan0
```

Can I use rc-update to automate this?  should I run this as default?

----------

