DKMS Device Driver for WiFi Modules

Automatically rebuilds and installs on kernel updates. DKMS is in official sources of Ubuntu, for installation do:

sudo apt install build-essential dkms git
Kernel 5.15.0-46 under Ubuntu 22.04 seems to have some compatibility issue with rtl8812au-dkms|
If you were facing it, you should go Install build dkms from source code below and install it.

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install rtl8812au-dkms using apt by running the following command:

sudo apt -y install rtl8812au-dkms

Clone the driver source from GitHub and the driver source must be copied to /usr/src/8812au-4.2.2

git clone https://github.com/gnab/rtl8812au
sudo cp -a rtl8812au /usr/src/8812au-4.2.2

Then add it to DKMS:

sudo dkms add -m 8812au -v 4.2.2
sudo dkms build -m 8812au -v 4.2.2
sudo dkms install -m 8812au -v 4.2.2

Clone the driver source from GitHub.

git clone https://github.com/brektrou/rtl8821CU
cd rtl8821CU

Add this to DKMS.

sudo ./dkms-install.sh

If steps above worked fine and in order to avoid periodically having to make usb_modeswitch you can make it permanent
Then add the following contents to enable the WiFi feature in every boot.

Before editing usb_modeswitch rules, check whether it is on the list or not.

grep ".0bda.*1a2b" /lib/udev/rules.d/40-usb_modeswitch.rules

If it shows us as below, you don't need to add the line.

ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="usb_modeswitch '/%k'"

If the line doesn't show up, edit usb_modeswitch rules.

sudo vi /lib/udev/rules.d/40-usb_modeswitch.rules

Append before the end line LABEL=“modeswitch_rules_end” the following:

# Realtek 8821CU Wifi AC USB
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch '/%k'"

Reload udev rules to apply the changes without rebooting.

sudo udevadm control --reload-rules && sudo udevadm trigger
  • If you lost the WiFi module 5B after rebooting your system, you can re-enable that by using the following command. To do this automatically, there're so many ways to do that such as using systemd, an init script, or a Python script.
sudo udevadm control trigger
  • odroid-h3/application_note/howto_wifi_driver_rtl8812au.txt
  • Last modified: 2022/10/12 14:36
  • by luke.go