DKMS Device Driver for WiFi Modules
Preparation
Automatically rebuilds and installs on kernel updates. DKMS is in official sources of Ubuntu, for installation do:
- target
sudo apt install build-essential dkms git
WiFi Module 5 and 5A
Install rtl8812au-dkms Using apt
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.
- target
sudo apt update
After updating apt database, We can install rtl8812au-dkms using apt by running the following command:
- target
sudo apt -y install rtl8812au-dkms
Install build dkms from source code
Clone the driver source from GitHub and the driver source must be copied to /usr/src/8812au-4.2.2
- target
git clone https://github.com/gnab/rtl8812au sudo cp -a rtl8812au /usr/src/8812au-4.2.2
Then add it to DKMS:
- target
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
WiFi Module 5B and 5BK
Clone the driver source from GitHub.
- target
git clone https://github.com/brektrou/rtl8821CU cd rtl8821CU
Add this to DKMS.
- target
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.
- target
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.
- target
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="usb_modeswitch '/%k'"
If the line doesn't show up, edit usb_modeswitch rules.
- target
sudo vi /lib/udev/rules.d/40-usb_modeswitch.rules
Append before the end line LABEL=“modeswitch_rules_end” the following:
- target
# 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.
- target
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.
- target
sudo udevadm control trigger