WiFi on Gentoo using a RTL8192CU wireless adapter

I’m trying to set up a wifi network interface on my Gentoo box, using a Realtek RTL8192CU wireless adapter.

After poking in the kernel configuration menu, I activated the following items:

  • Networking support > Wireless (CONFIG_WIRELESS)
  • Networking support > Wireless > cfg80211 – wireless configuration API (CONFIG_CFG80211)
  • Networking support > Wireless > enable powersave by default (CONFIG_CFG80211_DEFAULT_PS)
  • Networking support > Wireless > cfg80211 wireless extensions compatibility (CONFIG_CFG80211_WEXT)
  • Networking support > Wireless > Generic IEEE 802.11 Networking Stack (mac80211) (CONFIG_MAC80211)
  • Networking support > Wireless > Enable LED triggers (CONFIG_MAC80211_LEDS)
  • Networking support > RF switch subsystem support (CONFIG_RFKILL)
  • Device Drivers > Network device support > Wireless LAN (CONFIG_WLAN)
  • Device Drivers > Network device support > Wireless LAN > Realtek rtlwifi family of devices (CONFIG_RTL_CARDS, as a module)
  • Device Drivers > Network device support > Wireless LAN > Realtek rtlwifi family of devices > Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter (CONFIG_RTL8192CU, as a module)

I then eagerly rebooted, and was met with the following entries in dmesg:

rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 08:86:3b:ac:c6:88
rtl8192cu: Board Type 0
rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
rtlwifi: Loading alternative firmware rtlwifi/rtl8192cufw.bin
rtlwifi: Firmware rtlwifi/rtl8192cufw_TMSC.bin not available

Apparently some firware was required but missing. Indeed, the new network interface did not show up with ifconfig -a or in /sys/class/net.

After some googling, I emerged the sys-kernel/linux-firmware package (with the savedconfig USE flag) and tweaked the configuration file to only install the rtl8192cufw_TMSC.bin firmware.
After rmmod-ing and insmod-ing back the rtl* modules, the log read:

rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 08:86:3b:ac:c6:88
rtl8192cu: Board Type 0
rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
rtlwifi: wireless switch is on
systemd-udevd[1710]: renamed network interface wlan0 to wlp0s29u1u8

Looks good. Let’s see what ifconfig -a says:

wlp0s29u1u8: flags=4098  mtu 1500
        ether 08:86:3b:ac:c6:88  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

Great!

Now on to activating the network interface:

$ ln -s /etc/init.d/net.lo /etc/init.d/net.wlp0s29u1u8
$ rc-service net.wlp0s29u1u8 start
 * Caching service dependencies ...                                   [ ok ]
 * Bringing up interface wlp0s29u1u8
 *   Starting wpa_supplicant on wlp0s29u1u8 ...
 *   /etc/wpa_supplicant/wpa_supplicant.conf not found                [ !! ]
 * ERROR: net.wlp0s29u1u8 failed to start

Snap. Well let’s just emerge -av net-wireless/wpa_supplicant, configure it according to the Gentoo wiki page on wpa_supplicant, and try again:

 * Caching service dependencies ...                                   [ ok ]
 * Bringing up interface wlp0s29u1u8
 *   Starting wpa_supplicant on wlp0s29u1u8 ...
Successfully initialized wpa_supplicant
 *   Starting wpa_cli on wlp0s29u1u8 ...                              [ ok ]
 *   Backgrounding ... ...
 * WARNING: net.wlp0s29u1u8 has started, but is inactive

Now let’s try to scan nearby networks:

$ wpa_cli scan
Selected interface 'wlp0s29u1u8'
OK
$ wpa_cli scan_results
Selected interface 'wlp0s29u1u8'
bssid / frequency / signal level / flags / ssid
f4:ca:e5:fe:6d:26       2452    -34     [WPA2-EAP-CCMP+TKIP][ESS]       FreeWifi_secure
f4:ca:e5:fe:6d:24       2452    -34     [WPA2-PSK-CCMP+TKIP][ESS]       Moria
c4:04:15:43:d3:9c       2452    -68     [WPA2-PSK-CCMP][WPS][ESS]       Moria_EXT
f4:ca:e5:fe:6d:25       2452    -34     [ESS]   FreeWifi

Success! :-)

Connecting to a network can then be done thanks to wpa_supplicant, either through configuration or helper programs such as wpa_cli or wpa_gui.
Another option is to use fully-fledged network management tools such as NetworkManager or Wicd (not useful on my desktop box, but that’s what I use on my netbook).

Leave a Reply

Your email address will not be published. Required fields are marked *