# Wireless configuration: Realtek rtl8188ce

## Sum1

I can't add or scan for any available access points using wpa_gui.

I'm stuck and don't know what to try next.

This is my wireless adapter as stated by lspci:

```
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)

   Subsystem: Realtek Semiconductor Co., Ltd. Device 8181

   Flags: bus master, fast devsel, latency 0, IRQ 17

   I/O ports at 2000 [size=256]

   Memory at f0000000 (64-bit, non-prefetchable) [size=16K]

   Capabilities: [40] Power Management version 3

   Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+

   Capabilities: [70] Express Endpoint, MSI 00

   Capabilities: [100] Advanced Error Reporting

   Capabilities: [140] Virtual Channel

   Capabilities: [160] Device Serial Number 01-91-81-fe-ff-4c-e0-00

   Kernel driver in use: rtl8192ce

```

ifconfig -a reports:

```
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether d0:df:9a:75:86:e8  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

/etc/wpa_supplicant/wpa_supplicant.conf  is set to look for my home wireless access point:

```
# Ensure that only root can read the WPA configuration

ctrl_interface_group=0

# Let wpa_supplicant take care of scanning and AP selection

ap_scan=1

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers

network={

  ssid="kobayashi"

  psk="test1234"

  # The higher the priority the sooner we are matched

  priority=5

}

# Same as previous, but request SSID-specific scanning (for APs that reject

# broadcast SSID)

network={

  ssid="kobayashi"

  scan_ssid=1

  psk="test1234"

  priority=2

}

```

/etc/conf.d/net is set as:

```
  GNU nano 2.3.1                    File: /etc/conf.d/net                                              

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc*/net.example* and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0="dhcp"

config_wlan0="dhcp"

modules="wpa_supplicant"

# To use dhcp

# ** Regardless of your dhcp client **, it's "dhcp", not "dhcpcd".

#config_wlan0="dhcp"

## Suffixes like _eth0 or _wlan0 are the interface name. Use ifconfig

## to check.

#

# For madwifi driver

#wpa_supplicant_ath0="-Dmadwifi"

# If you use kernel's driver, you don't need "-D" option,

# which is automatically set to "-Dwext"

# Instead of /etc/wpa_supplicant/wpa_supplicant.conf,

# you can use any configuration file:

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

```

----------

## khayyam

 *Sum1 wrote:*   

> I can't add or scan for any available access points using wpa_gui.

 

Sum1 ... if you set "ctrl_interface_group=0" then you won't be able to use wpa_gui as your user. The "0" denotes GID=0, or root. So, change /etc/wpa_supplicant/wpa_supplicant.conf to allow the group 'wheel' (which you should be a member of if you followed the handbook).

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

update_config=1
```

This should resolve the issue of not being able to scan/select AP's from within wpa_gui, and allow it to write your configured AP's to wpa_supplicant.conf

If you are not in the 'wheel' group you can add/modify your user with the following:

```
# usermod -a -G wheel <your_user>
```

Also, but unrelated to your not being able to use wpa_gui, having two entries in wpa_supplicant.conf for the same AP is not a good idea, you should use one or other of the above stanzas.

Another point of note, with config="wpa_supplicant" in conf.d/net you are also selecting to have eth0 managed by wpa_supplicant, this may or may not be what you want, to have only wlan0 managed use the following:

```
config_wlan0="!plug wpa_supplicant"
```

best ... khay

----------

## Sum1

Khayyam,

Thank you very much for the helpful response.

I've confirmed the user account is in the wheel group and made the changes you suggested.

The wpa_gui scanning for wireless networks is still not functioning.

Cannot manually add a wireless network as well.

The status continues to show as:  Could not get status from wpa_supplicant.

I notice too that the drop-down boxes for "Adapter" and "Network" do not show any recognized devices.

I must be missing something very basic -- my device is recognized by "ifconfig -a" but somehow not by wpa_supplicant.

I've got to try again from the beginning with the Handbook and Gentoo Wireless wiki.

I'm stumped.

----------

## khayyam

Sum1 ...

OK, on a brief search I see the rt1818ce uses MAC80211, so you should probably supply '-Dnl80211' to wpa_supplicant rather than '-Dwext'. I'm guessing the issue is that although MAC80211 is enabled in the kernel CONFIG_CFG80211_WEXT (the wext compatibility layer) is not, and so there is no "wireless extentions" (wext) for wpa_supplicant to use.

```
# awk '/(WEXT|(CFG|NL)80211)/' /usr/src/linux/.config
```

So, either change the '-D' (driver) option provided to wpa_supplicant, or rebuild the kernel with CFG80211_WEXT enabled. You might want to do the latter anyhow as some tools (those from wireless-tools ... iwconfig, iwlist) will need the compatibility layer in order to function.

I'm fairly sure this is the issue, if not then you might want to enable debugging for wpa_supplicant (the 'debug' useflag) and pastbin a log.

/etc/conf.d/net

```
wpa_supplicant_wlan0="-Dnl80211 -d -f /var/log/wpa_supplicant.log"
```

... '-d' can be increased to '-dd' for more debugging.

HTH & best ... khay

----------

## Sum1

Great stuff....quite a bit to learn for wireless gear.

Thanks, I will try the kernel recompile.

----------

## Sum1

I just took a look under Networking Support > Wireless and it looks like the compatibility item is already compiled into the kernel --

cfg80211 wireless extensions compatibility

I enabled the debugging features, and recompiling now.

----------

## Sum1

~ $ awk '/(WEXT|(CFG|NL)80211)/' /usr/src/linux/.config

CONFIG_WEXT_CORE=y

CONFIG_WEXT_PROC=y

CONFIG_WEXT_SPY=y

CONFIG_WEXT_PRIV=y

CONFIG_CFG80211=m

# CONFIG_NL80211_TESTMODE is not set

# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set

# CONFIG_CFG80211_REG_DEBUG is not set

CONFIG_CFG80211_DEFAULT_PS=y

# CONFIG_CFG80211_INTERNAL_REGDB is not set

CONFIG_CFG80211_WEXT=y

----------

## Sum1

khayyam,  I'm hoping you might have time to share your experience.  I'm still struggling to get wireless working on my notebook.

ifconfig -a reports:

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

        inet6 fe80::d2df:9aff:fe75:86e8  prefixlen 64  scopeid 0x20<link>

        ether d0:df:9a:75:86:e8  txqueuelen 1000  (Ethernet)

        RX packets 24  bytes 1668 (1.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 8  bytes 876 (876.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

(I have followed the udev upgrade guide for setting up networking devices)

/etc/conf.d/wpa_supplicant.conf is configured as follows:

```
# The below line not be changed otherwise we refuse to work

ctrl_interface=/usr/sbin/wpa_supplicant  GROUP=wheel

update_config=1

# USER HAS BEEN ADDED TO WHEEL IN /ETC/GROUP

# Ensure that only root can read the WPA configuration

#ctrl_interface_group=0

# Let wpa_supplicant take care of scanning and AP selection

ap_scan=1

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers

network={

  ssid="MYLOCAL"

  psk="test123"

  # The higher the priority the sooner we are matched

  priority=5

}

```

I remain unable to use /usr/bin/wpa_gui to configure my wireless device or scan for wireless networks so I created a brief wpa_supplicant start-up bash script.

/home/user/wpa_supplicant_start:

```
#/bin/bash

/usr/sbin/wpa_supplicant -i wlp2s0 -c /etc/conf.d/wpa_supplicant.conf -D wext,nl80211

```

Output from running wpa_supplicant_start:

```
~# ./wpa_supplicant_start

Trying to associate with b0:c7:45:07:a6:90 (SSID='MYLOCAL' freq=2412 MHz)

ioctl[SIOCSIWFREQ]: Device or resource busy

Association request to the driver failed

Associated with b0:c7:45:07:a6:90

WPA: Key negotiation completed with b0:c7:45:07:a6:90 [PTK=CCMP GTK=CCMP]

CTRL-EVENT-CONNECTED - Connection to b0:c7:45:07:a6:90 completed (auth) [id=0 id_str=]

```

After executing the above script, ifconfig reports:

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

        inet6 fe80::d2df:9aff:fe75:86e8  prefixlen 64  scopeid 0x20<link>

        ether d0:df:9a:75:86:e8  txqueuelen 1000  (Ethernet)

        RX packets 32  bytes 2310 (2.2 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 16  bytes 1752 (1.7 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

No luck connecting or obtaining ip address.

Thank you for any guidance you can provide.

----------

## hdcg

Hi,

your ctrl interface path in wpa_supplicant.conf is misconfigured:

```
ctrl_interface=/usr/sbin/wpa_supplicant  GROUP=wheel 
```

It is pointing at the executable. Change it to:

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

Best Regards,

Holger

----------

## Sum1

 *hdcg wrote:*   

> Hi,
> 
> Change it to:
> 
> ```
> ...

 

Thank you for the quick response hdcg.

I made the change to wpa_supplicant.conf but still the same result:

```
~# ./wpa_supplicant_start

Trying to associate with b0:c7:45:07:a6:90 (SSID='MYLOCAL' freq=2412 MHz)

ioctl[SIOCSIWFREQ]: Device or resource busy

Association request to the driver failed

Associated with b0:c7:45:07:a6:90

WPA: Key negotiation completed with b0:c7:45:07:a6:90 [PTK=CCMP GTK=CCMP]

CTRL-EVENT-CONNECTED - Connection to b0:c7:45:07:a6:90 completed (auth) [id=0 id_str=]

```

And the ifconfig shows no ip address and connection to access point:

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

        inet6 fe80::d2df:9aff:fe75:86e8  prefixlen 64  scopeid 0x20<link>

        ether d0:df:9a:75:86:e8  txqueuelen 1000  (Ethernet)

        RX packets 38  bytes 3156 (3.0 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 40  bytes 4380 (4.2 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

----------

## hdcg

Hi,

I assume that the missing ipv4 address is due to the manual start of wpa_supplicant. wpa_supplicant only establishes the connection to the WLAN. Afterwards dhclient or the like needs to be invoked to obtain an ip address. To get it working you could try to invoke your dhcp client by hand.

Afterwards you should try to get everything up by only configuring /etc/conf.d/net .

Best Regards,

Holger

----------

## Sum1

 *hdcg wrote:*   

> Afterwards you should try to get everything up by only configuring /etc/conf.d/net .
> 
> 

 

I am getting some unexpected behavior.

My /etc/conf.d/net is straightforward:

```
mhf # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc*/net.example* and save your configuration

# in /etc/conf.d/net (this file :]!).

config_enp1s0="dhcp"

modules="wpa_supplicant"

wpa_supplicant_wlp2s0="-Dwext,nl80211"

config_wlp2s0="dhcp"

```

Regardless of whether the wired connection via ethernet nic enp1s0 is used, the wireless device does not receive an address.

I need to manually issue /etc/init.d/wpa_supplicant stop and killall dhcpcd.

Then I can do "/etc/init.d/wpa_supplicant start" and "dhcpcd wlp2s0".

Then my wireless connection works.

But I cannot figure any way to make it work upon boot up by adding net.wlp2s0 and wpa_supplicant and dhcp to default at startup.

----------

## khayyam

 *Sum1 wrote:*   

> I am getting some unexpected behavior. My /etc/conf.d/net is straightforward:
> 
> ```
> modules="wpa_supplicant"
> ```
> ...

 

Sum1 ... this will configure openrc to use wpa_supplicant for any/every device, so configure it to be more specific, as you probably don't need to use a ieee802.1x supplicant for enp1s0:

```
config_enp1s0="dhcp"

modules_enp1s0="dhcpcd"

modules_wlp2s0="!plug wpa_supplicant dhcpcd"

wpa_supplicant_wlp2s0="-Dnl80211,wext -qq"

config_wlp2s0="dhcp"
```

Note net-misc/dhcpcd is provided as the dhcp client to use, you may not have, or use, this. I also swapped the possition of 'wext' from the list of wpa_supplicant drivers, nl80211 should be prefered if your driver is using cfg80211 (and most likely it is).

 *Sum1 wrote:*   

> Regardless of whether the wired connection via ethernet nic enp1s0 is used, the wireless device does not receive an address.I need to manually issue /etc/init.d/wpa_supplicant stop and killall dhcpcd. Then I can do "/etc/init.d/wpa_supplicant start" and "dhcpcd wlp2s0". Then my wireless connection works.

 

This sounds like the result of the above ... 

 *Sum1 wrote:*   

> But I cannot figure any way to make it work upon boot up by adding net.wlp2s0 and wpa_supplicant and dhcp to default at startup.

 

/etc/init.d/wpa_supplicant shouldn't be used, or be in any runlevel, wpa_supplicant is called when /etc/init.d/net.wlp2s0 is started, the former is for running wpa_supplicant on its own. The same is true for /etc/init.d/dhcpcd. So, just remove these from the runlevel and use net.wlp2s0 exclusively. Infact, you may want to add the following to /etc/rc.conf:

```
rc_depend_strict="NO"

rc_dhcpcd_provide="!net"
```

The former will allow either net.wlp2s0 or net.enp1s0 to satisfy the 'net' requirement, and the latter will remove 'dhcpcd' as a potencial provider of 'net'

best ... khay

----------

## Sum1

hdcg and khayyam, thank you very much for the guidance.

it's all coming together now.

i need to go back and write out all the correct steps from the beginning and also get a better understanding of using these fundamental services upon startup.

i've been using gentoo for a while on servers, but this is my first notebook/desktop install in several years, and it's been full of new items on the checklist.   :Smile: 

i appreciate your patience.

----------

