The built-in support for Realtek RTL8192EU[1][2] in Ubuntu 20.04 LTS has some issues with D-Link DWA-131 E1[3]. It provides a weak signal and slow WiFi. To improve, I have to download the RTL8192EU driver source code, compile to a kernel module, add it to the kernel, remove the existing drivers, and fix the detection issue.
The following USB wireless dongle uses the RTL8192EU chipset:
- D-Link DWA-131 E1
Quick Summary
For Ubuntu 18.04 LTS and 20.04LTS, follow these steps:
$sudo apt-get update $sudo apt-get install dkms git $git clone https://github.com/Mange/rtl8192eu-linux-driver $cd ~/rtl8192eu-linux-driver $sudo rmmod 8192eu $sudo rmmod rtl8xxxu $sudo dkms remove rtl8192eu/1.0 --all $sudo dkms add . $sudo dkms install rtl8192eu/1.0 $sudo depmod -a $echo "blacklist rtl8xxxu" | sudo tee /etc/modprobe.d/rtl8xxxu.conf $echo -e "8192eu\n\nloop" | sudo tee /etc/modules $echo "options 8192eu rtw_power_mgnt=0 rtw_enusbss=0" | sudo tee /etc/modprobe.d/8192eu.conf $sudo update-grub $sudo update-initramfs -u; $sudo shutdown -r now
Prepare to Build
Get codes and tools in different packages:
$sudo apt-get update $sudo apt-get install linux-headers-generic build-essential git
Or the dkms (Dynamic Kernel Module Support Framework)[4] package:
$sudo apt-get update $sudo apt-get install dkms git
- Get only the essential Linux kernel headers[5]. I am not going to compile the full kernel.[6]
- Get the build-essential package[7] which includes
- Debian package development tools
- C/C++ Compilers
- Development Libraries and Header Files
- Make utility
- Get the Git[8] which contains the tool to clone the source code from a git server.
- Get the dkms which contains code and tools in linux-headers-generic and build-essential.
Build and Install Kernel Module
I have tested two different contributors: Mange[9] declares its support for D-Link DWA-131 rev E1 explicitly in the about section but required manual install. clnhub[10] has some issues with detection but provides a shell script install_wifi.sh to simplify installation.
Because Mange may detect correctly, I preferred to use his fork.
Always read the “README.md” to check if it works with the current kernel.
Because there is build-in support for RTL8192EU in Ubuntu LTS 20.04, I need to remove them first. I also remove any previously installed RTL8192EU drivers.
$sudo rmmod 8192eu $sudo rmmod rtl8xxxu $sudo dkms remove rtl8192eu/1.0 --all
Then use dkms to install:
$sudo dkms add . $sudo dkms install rtl8192eu/1.0
The last is to probe and update all installed modules:
$sudo depmod -a
Assign the Driver to Load at Boot
This is the tricky part.
Mange is complex but thoroughly. Edit files rtl8xxxu.conf, modules, 8192eu.conf manually if they already exist.
- Add rtl8xxxu to the blacklist.
- Add 8192eu to be loaded at boot time.
- Solve the plugging/replugging issue.
- Update changes to Grub & initramfs.
$echo "blacklist rtl8xxxu" | sudo tee /etc/modprobe.d/rtl8xxxu.conf $echo -e "8192eu\n\nloop" | sudo tee /etc/modules $echo "options 8192eu rtw_power_mgnt=0 rtw_enusbss=0" | sudo tee /etc/modprobe.d/8192eu.conf $sudo update-grub $sudo update-initramfs -u;
clnhub just add rtl8xxxu to the blacklist:
$echo "blacklist rtl8xxxu" >> ./blacklist-rtl8xxxu.conf $echo mv ./blacklist-rtl8xxxu.conf /etc/modprobe.d/
It is suggested to reboot for a complete test.
Detect Installed RTL8192EU Devices
The installed kernel module is “8192eu”:
$sudo modprobe 8192eu
Issues
N/A
Special Topics
Device Name in WiFi Settings
To find the name used for DWA-131, first, find the vendor and product ID by lsusb:
$ lsusb Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 007: ID 17ef:480f Lenovo Integrated Webcam [R5U877] Bus 001 Device 025: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1) Bus 001 Device 005: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor Bus 001 Device 004: ID 2001:3319 D-Link Corp. Bus 001 Device 003: ID 046d:c50a Logitech, Inc. Cordless Mouse Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The only D-Link device is “Bus 001 Device 004: ID 2001:3319 D-Link Corp”. It’s the 004 device connected to USB. The vendor ID is 2001 while the product ID is 3319.
Next, run usb_modeswitch to fetch device information:
$sudo /usr/sbin/usb_modeswitch -W -v 2001 -p 3319 Take all parameters from the command line</pre> * usb_modeswitch: handle USB devices with multiple modes * Version 2.5.2 (C) Josua Dietze 2017 * Based on libusb1/libusbx ! PLEASE REPORT NEW CONFIGURATIONS ! DefaultVendor= 0x2001 DefaultProduct= 0x3319 Look for default devices ... found USB ID 8087:0020 found USB ID 1d6b:0002 found USB ID 1d6b:0003 found USB ID 1d6b:0002 found USB ID 17ef:480f found USB ID 0a5c:217f found USB ID 147e:2016 found USB ID 2001:3319 vendor ID matched product ID matched found USB ID 046d:c50a found USB ID 8087:0020 found USB ID 1d6b:0002 Found devices in default mode (1) Access device 004 on bus 001 Get the current device configuration ... Current configuration number is 1 Use interface number 0 with class 255 USB description data (for identification) ------------------------- Manufacturer: Realtek Product: Wireless N Nano USB Adapter Serial No.: 00e04c000001 ------------------------- Warning: no switching method given. See documentation -> Run lsusb to note any changes. Bye!
The “Wireless N Nano USB Adapter” in the “USB description data” is the name displayed in the WiFi Settings.
Reference
- DeviWikiDev: Realtek: Wireless chipsets
- Realtek: RTL8192EU
- DeviWiki: D-Link DWA-131 rev E1
- Ubuntu: Package: dkms (2.3-3ubuntu9)
- Ubuntu: Package: linux-headers-generic (4.15.0.96.87 and others) [security]
- nixCraft: Howto: Build Linux Kernel Module Against Installed Kernel w/o Full Kernel Source Tree
- Ubuntu: Package: build-essential (12.4ubuntu1)
- Ubuntu: Package: git (1:2.17.1-1ubuntu0.7 and others) [security]
- GitHub: Mange/rtl8192eu-linux-driver
- GitHub: clnhub/rtl8192eu-linux
- Style Guide
Thanks. Took a while to find a solution that worked.
LikeLike
Following these instructions made my Ubuntu 22 system completely unstable and unresponsive.
LikeLike