Build the Linux Kernel Module to Enable RTL8812AU USB Wireless Dongles


There is no built-in support for Realtek RTL8812AU[1][2] in Linux. To enable, I have to download the RTL8122AU driver source code, compile to a kernel module, and add to the kernel.

Following USB wireless dongles use the RTL8812AU chipset:

  1. D-Link DWA-171 A1[3]
  2. Edimax EW-7811UTC[4]
  3. netis WF2190[5]
  4. TP-Link Archer T2U Ver 3.0 (RTL8811AU)

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/aircrack-ng/rtl8812au.git
$cd ~/rtl8812au
$sudo make dkms_install
$sudo modprobe 88XXau

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)[6] package:

$sudo apt-get update
$sudo apt-get install dkms git
  1. Get only the essential Linux kernel headers[7]. I am not going to compile the full kernel.[8]
  2. Get the build-essential package[9] which includes
    • Debian package development tools
    • C/C++ Compilers
    • Development Libraries and Header Files
    • Make utility
  3. Get the Git[10] which contains the tool to clone the source code from a git server.
  4. Get the dkms which contains code and tools in linux-headers-generic and build-essential.

I may download the source code from GitHub without Git. But it’s just more convenient to manage the source code, especially when I need to rebuild the module for a new kernel.

Build and Install Kernel Module

chili555[11][12] suggests qnab[13] while Jeremy31[14] chooses aircrack-ng[15]. If it doesn’t work for me, I may use the “fork from” to find the parent. Or search “RTL8812AU” for more solutions. Always read the “README.md” to check if it works with the current kernel.

Forked from Information
Track the “forked from” source on GitHub if it is not updated for a while.

Here are 3 examples to download, build the module, and install:

For the qnab’s code, clone the latest version and use make to build/install:

$git clone https://github.com/qnab/rtl8812au.git
$cd ~/rtl8812au
$make
$sudo make install

For the aircrack-ng’s code, if the kernel is compatible with “v5.6.4.2”, clone the branch “v5.6.4.2” and use make to build/install:

$git clone -b v5.6.4.2 https://github.com/aircrack-ng/rtl8812au.git
$cd ~/rtl8812au
$make
$sudo make install

For the aircrack-ng’s code, clone the latest version and use the shell script to build/install:

$git clone https://github.com/aircrack-ng/rtl8812au.git
$cd ~/rtl8812au
$sudo make dkms_install

Because aircrack-ng commits more frequently and newer than qnab as checked on 2020/4/26, I preferred to use his fork.

Detect Installed RTL8812AU Devices

For the qnab, the kernel module is “8812au” which is in the “MODULE_NAME = 8812au” in the “Makefile” file:

$sudo modprobe 8812au

For the aircrack-ng, the kernel module is “88XXau” which is in the “BUILT_MODULE_NAME[0]=88XXau” in the “dkms.conf” file.

$sudo modprobe 88XXau

Issues

Unstable in Ubuntu 19.10

I have applied the same steps in Ubuntu 19.10 but the wireless connection is not stable. The connection looks okay but is very slow or no response at all. It goes back normal after a while sometimes. There are similar issues with Intel’s wireless driver.[16][17]

Special Topics

Check the Chipset

Many wireless USB dongles use Realtek’s chipset. It’s suggested to check the chipset from following web site after WikiDevi shut down its service[18]:

  1. Wireless CAT[19] – reborn and updated continuously. The latest update is 2020/4/27 as checked on 2020/4/27.
  2. Info Depot Wiki[20] – similar to Wireless CAT. The latest update is 2020/4/26 as checked on 2020/4/27.
  3. DeviWiki[21] – a mirror site of the original WikiDevi
Wireless Dongles
These USB wireless dongles all use the same Realtek RTL8812AU chipset.

Other Realtek Ubuntu Drivers

Pjotr shares his experience dealing with different Realtek chipsets on Linux Mint 19.x and Ubuntu 18.04.x.[22] For those not using RTL8812AU, it would help.

Reference

  1. DeviWikiDev: Realtek: Wireless chipsets
  2. Realtek: RTL8812AU
  3. DeviWiki: D-Link DWA-171 rev A1
  4. DeviWiki: Edimax EW-7811UTC
  5. DeviWiki: Netis WF2190
  6. Ubuntu: Package: dkms (2.3-3ubuntu9)
  7. Ubuntu: Package: linux-headers-generic (4.15.0.96.87 and others) [security]
  8. nixCraft: Howto: Build Linux Kernel Module Against Installed Kernel w/o Full Kernel Source Tree
  9. Ubuntu: Package: build-essential (12.4ubuntu1)
  10. Ubuntu: Package: git (1:2.17.1-1ubuntu0.7 and others) [security]
  11. Ubuntu: Forums: How to install Edimax EW-7811UTC AC600 Wireless USB with no internet (no ethernet)
  12. StackOerflow: RTL8812AU Usb adapter driver issues
  13. GitHub: gnab/rtl8812au
  14. AskUbuntu: Need rtl8814au driver for kernel 5.3 on Ubuntu 19.10
  15. GitHub: aircrack-ng/rtl8812au
  16. AskUbuntu: Ubuntu 18.04.1 LTS Intel wireless is very slow with kernel 4.15 [closed]
  17. Ubuntu linux package: Bugs: Driver iwlwifi for Intel Wireless-AC 9560 is slow and unreliable in kernel 4.15.0-20-generic
  18. OpenWRT: WikiDevi going down soon
  19. Wireless CAT
  20. Info Depot Wiki
  21. DeviWiki
  22. Easy Linux Tips Project: Realtek wireless chipset: install the right driver

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.