Realtek 8192EU (RTL8192EU) Driver Not Compatible with CentOS 7.6 Kernel

tl;dr: On a vanilla CentOS 7.6 installation, it is not possible to install the Realtek 8192EU driver due to kernel incompatibilities.

I bought an AmazonBasics branded Wi-Fi 11N USB Adapter and was keen to set it up with a vanilla minimal install CentOS 7.6. It uses the RTL8192EU chipset and while the official Realtek drivers are only available for Windows, there are a bunch of community maintained Linux drivers around.

After attempting for approximately 12 hours, I have come to the understanding that unless the kernel is upgraded, or the existing wireless chipset driver files are updated (tried 6 different repos), it is not possible to compile and install it on CentOS 7.6. This is due to the ioctl_cfg80211.c file being incompatible with the 3.10.0-957 kernel version that CentOS 7.6 uses.

These links (link1, link2) explain that while the CentOS 7.6 kernel version is 3.10.0, Red Hat has backported large portions of the network stack from more recent 4.x kernels.

The rest of this post documents my process and hopefully to help out anyone who is also encountering the same issue.

Step 1) Discovering the Wireless Chipset

Setting aside the AmazonBasics branding, I needed to know the make and model of the wireless chipset. I plugged the adapter into my CentOS machine and used dmesg to find out more from the kernel’s message buffer. 

# dmesg
...
usb 3-4: New USB device found, idVendor=0bda, idProduct=818b
usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-4: Product: 802.11n NIC
usb 3-4: Manufacturer: Realtek
usb 3-4: SerialNumber: (redacted)

Combining the idVendor and idProduct values and doing a quick Google search immediately returns a list of forum posts regarding “Realtek RTL8192EU” devices. Alternatively, I could use a USB ID repository like linux-usb.org to find out that it was the “RTL8192EU 802.11b/g/n WLAN Adapter”.

Step 2: Finding Linux Drivers for the Wireless Chipset

I checked the official Realtek website and could only find the Windows drivers, but I did discover several community maintained drivers for the RTL8192EU chipset. While there were many versions and slight variations to each package’s instructions, they were not too far apart from each other.

I ultimately chose this post to follow: https://adamscheller.com/systems-administration/rtl8192cu-fix-wifi/, as it was the easiest to understand. Although it does say that it is for the “RTL8192CU” chipset, the difference in the name postfix are for the various WLAN standards.

Step 3: Preparing the Required Packages

Starting with a fresh CentOS 7.6 minimum installation:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum update 
# yum install kernel-devel gcc dkms git

Downloading the Linux wireless chipset driver:

$ git clone https://github.com/pvaret/rtl8192cu-fixes.git

I ended up with a rtl8192cu-fixes directory in my current working directory.

Step 4: Using dkms to Compile the Driver

Use dkms to add the driver as a module to the kernel tree:

# dkms add ./rtl8192cu-fixes
Creating symlink /var/lib/dkms/8192cu/1.11/source -> 
                 /usr/src/8192cu-1.11

Then to install it:

# dkms install 8192cu/1.11

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j1 KERNELRELEASE=3.10.0-957.27.2.el7.x86_64 -C /lib/modules/3.10.0-957.27.2.el7.x86_64/build M=/var/lib/dkms/8192cu/1.11/build..........(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.10.0-957.27.2.el7.x86_64 (x86_64)
Consult /var/lib/dkms/8192cu/1.11/build/make.log for more information.

From the output above, there was a bad exit status when attempting to build the driver module on the 3.10.0-957 kernel. I looked into the make.log and tried to decipher some of the errors, and even upgraded the gcc and kernel version in attempt to fix this, but those attempts were unsuccessful. I eventually found the links above that explained the root cause of the issue in detail.

I tried the same instructions with Lubuntu 18.04 (which uses the 4.15.0-58-generic kernel) and the compilation and installation steps were successful.

Appendix – make.log Dump

Will post a dump of the make.log here in case anyone is interested:

# cat /var/lib/dkms/8192cu/1.11/build/make.log
DKMS make.log for 8192cu-1.11 for kernel 3.10.0-957.27.2.el7.x86_64 (x86_64)
Fri Aug 30 17:37:11 EDT 2019
make: Entering directory `/usr/src/kernels/3.10.0-957.27.2.el7.x86_64'
  LD      /var/lib/dkms/8192cu/1.11/build/built-in.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_cmd.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_security.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_debug.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_io.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_ioctl_query.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_ioctl_set.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_ieee80211.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_mlme.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_mlme_ext.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_wlan_util.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_pwrctrl.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_rf.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_recv.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_sta_mgt.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_ap.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_xmit.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_p2p.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_tdls.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_br_ext.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_iol.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/rtw_sreset.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/core/efuse/rtw_efuse.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/hal_intf.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/hal_com.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/dm.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_hal_init.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_phycfg.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_rf6052.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_dm.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_rxdesc.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_cmd.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/usb_halinit.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/rtl8192cu_led.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/rtl8192cu_xmit.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/rtl8192cu_recv.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/usb_ops_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_sreset.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/rtl8192c_xmit.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/hal/rtl8192c/usb/Hal8192CUHWImg.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/osdep_service.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/os_intfs.o
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/os_intfs.c:1016:2: warning: initialization from incompatible pointer type [enabled by default]
  .ndo_select_queue = rtw_select_queue,
  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/os_intfs.c:1016:2: warning: (near initialization for ‘rtw_netdev_ops..ndo_select_queue’) [enabled by default]
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/usb_intf.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/usb_ops_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/xmit_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/mlme_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/recv_linux.o
  CC [M]  /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.o
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_connect’:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:666:4: warning: passing argument 2 of ‘cfg80211_roamed’ from incompatible pointer type [enabled by default]
    , GFP_ATOMIC);
    ^
In file included from /var/lib/dkms/8192cu/1.11/build/include/osdep_service.h:797:0,
                 from /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:23:
include/net/cfg80211.h:5505:6: note: expected ‘struct cfg80211_roam_info *’ but argument is of type ‘struct ieee80211_channel *’
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:666:4: warning: passing argument 3 of ‘cfg80211_roamed’ makes integer from pointer without a cast [enabled by default]
    , GFP_ATOMIC);
    ^
In file included from /var/lib/dkms/8192cu/1.11/build/include/osdep_service.h:797:0,
                 from /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:23:
include/net/cfg80211.h:5505:6: note: expected ‘gfp_t’ but argument is of type ‘unsigned char *’
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:666:4: error: too many arguments to function ‘cfg80211_roamed’
    , GFP_ATOMIC);
    ^
In file included from /var/lib/dkms/8192cu/1.11/build/include/osdep_service.h:797:0,
                 from /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:23:
include/net/cfg80211.h:5505:6: note: declared here
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_disconnect’:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:729:4: error: too few arguments to function ‘cfg80211_disconnected’
    cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC);
    ^
In file included from /var/lib/dkms/8192cu/1.11/build/include/osdep_service.h:797:0,
                 from /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:23:
include/net/cfg80211.h:5521:6: note: declared here
 void cfg80211_disconnected(struct net_device *dev, u16 reason,
      ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: In function ‘cfg80211_rtw_get_station’:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1620:20: error: ‘STATION_INFO_SIGNAL’ undeclared (first use in this function)
   sinfo->filled |= STATION_INFO_SIGNAL;
                    ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1620:20: note: each undeclared identifier is reported only once for each function it appears in
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1627:20: error: ‘STATION_INFO_TX_BITRATE’ undeclared (first use in this function)
   sinfo->filled |= STATION_INFO_TX_BITRATE;
                    ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1634:20: error: ‘STATION_INFO_RX_PACKETS’ undeclared (first use in this function)
   sinfo->filled |= STATION_INFO_RX_PACKETS;
                    ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1641:20: error: ‘STATION_INFO_TX_PACKETS’ undeclared (first use in this function)
   sinfo->filled |= STATION_INFO_TX_PACKETS;
                    ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_scan_done’:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:1841:4: error: incompatible type for argument 2 of ‘cfg80211_scan_done’
    cfg80211_scan_done(pwdev_priv->scan_request, aborted);
    ^
In file included from /var/lib/dkms/8192cu/1.11/build/include/osdep_service.h:797:0,
                 from /var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:23:
include/net/cfg80211.h:4628:6: note: expected ‘struct cfg80211_scan_info *’ but argument is of type ‘bool’
 void cfg80211_scan_done(struct cfg80211_scan_request *request,
      ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_sta_assoc’:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:3148:18: error: ‘STATION_INFO_ASSOC_REQ_IES’ undeclared (first use in this function)
   sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
                  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c: At top level:
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5241:2: warning: initialization from incompatible pointer type [enabled by default]
  .change_virtual_intf = cfg80211_rtw_change_iface,
  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5241:2: warning: (near initialization for ‘rtw_cfg80211_ops.change_virtual_intf’) [enabled by default]
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5261:2: warning: initialization from incompatible pointer type [enabled by default]
  .add_virtual_intf = cfg80211_rtw_add_virtual_intf,
  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5261:2: warning: (near initialization for ‘rtw_cfg80211_ops.add_virtual_intf’) [enabled by default]
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5275:2: warning: initialization from incompatible pointer type [enabled by default]
  .del_station = cfg80211_rtw_del_station,
  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5275:2: warning: (near initialization for ‘rtw_cfg80211_ops.del_station’) [enabled by default]
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5292:2: warning: initialization from incompatible pointer type [enabled by default]
  .mgmt_tx = cfg80211_rtw_mgmt_tx,
  ^
/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.c:5292:2: warning: (near initialization for ‘rtw_cfg80211_ops.mgmt_tx’) [enabled by default]
make[1]: *** [/var/lib/dkms/8192cu/1.11/build/os_dep/linux/ioctl_cfg80211.o] Error 1
make: *** [_module_/var/lib/dkms/8192cu/1.11/build] Error 2
make: Leaving directory `/usr/src/kernels/3.10.0-957.27.2.el7.x86_64'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s