How to Install RTL8821CU on Ubuntu? [SOLVED]


Tutorial

Author: Omer Cakmak
Reviewer: Deepak Prasad

What is RTL8821CU?

rtl8821cu is a wireless network card driver produced by Realtek. It is commonly found in many wireless USB adapters. This chipset supports both Wi-Fi (802.11ac) and Bluetooth functionalities. In this article, we will explain how you can install RTL8821CU on Ubuntu. Before we start, let's go through some of the features of this driver:

  1. Functionality: The chipset supports both Wi-Fi and Bluetooth connectivity. This dual-functionality makes it a popular choice for many USB Wi-Fi dongles that also offer Bluetooth capabilities.
  2. Wi-Fi Capabilities: It offers support for the 802.11ac Wi-Fi standard, which is one of the faster standards available, providing high-speed wireless connections when paired with compatible routers and devices.
  3. Bluetooth: On top of its Wi-Fi capabilities, the chipset also supports Bluetooth, allowing devices with this chip to connect to a range of Bluetooth devices like headphones, mice, keyboards, and more.
  4. Operating System Support: As with many chipsets, while there's generally good support for Windows due to drivers provided by device manufacturers or Realtek itself, Linux support can be more hit or miss. As of my last update in 2021, users might have needed to manually install drivers to get full functionality on some Linux distributions.
  5. Size and Use Case: Given its small size and the integration of both Wi-Fi and Bluetooth functionalities, this chipset is often found in compact USB dongles, making it easy for users to add wireless capabilities to devices that might lack them, like certain desktop PCs or older laptops.
  6. Popularity: Realtek is one of the major players in the networking hardware industry, and their products, including the RTL8821CU, are widely adopted due to their reliability and performance. As such, you'll find this chipset in a variety of devices from different manufacturers.

 

 

Install RTL8821CU on Ubuntu

On Linux, DKMS (Dynamic Kernel Module Support) is a system for dynamically compiling and managing kernel modules (drivers). It is used to keep drivers compatible and working during kernel updates or upgrades.

DKMS is a tool available in various Linux distributions. It is often used for management of third-party drivers (drivers provided by hardware manufacturers, etc.). DKMS prevents users from dealing with complex operations such as manually compiling, installing and updating drivers, thus providing an easier and smoother driver management.

We will share the steps of installing the rtl8821CU driver on Ubuntu both with DKMS and without DKMS.

 

Method-1: Build and install with DKMS

First, download the source codes of the driver from the Github page:

foc@ubuntu22:~$ git clone https://github.com/whitebatman2/rtl8821CU.git
Cloning into 'rtl8821CU'...
remote: Enumerating objects: 669, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 669 (delta 0), reused 2 (delta 0), pack-reused 666
Receiving objects: 100% (669/669), 3.32 MiB | 1.21 MiB/s, done.
Resolving deltas: 100% (247/247), done.

Then go to the source code directory:

$ cd rtl8821CU/

Install the DKMS package on Ubuntu:

$ sudo apt install dkms -y

Enter the driver name, version. Run the following commands in order:

DRV_NAME=rtl8821CU
DRV_VERSION=5.2.5.3
sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}

Add the new kernel module source to the DKMS system with the following command:

foc@foc:~/rtl8821CU$ sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}

Creating symlink /var/lib/dkms/rtl8821CU/5.2.5.3/source ->
                 /usr/src/rtl8821CU-5.2.5.3

DKMS: add completed.

Start building the kernel module (driver):

foc@foc:~/rtl8821CU$ sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
'make' KVER=5.4.0-144-generic........................
cleaning build area...

DKMS: build completed.

Start building and loading the module (driver):

foc@foc:~/rtl8821CU$ sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}

8821cu.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-144-generic/updates/dkms/

depmod...

DKMS: install completed.

Load the compiled module into the system:

$ sudo modprobe 8821cu

You can now see the 8821cu in the loaded modules:

$ lsmod | grep 8821
8821cu               1826816  0
cfg80211              708608  1 8821cu

 

Method-2: Build and install without DKMS

To install the 8821cu driver without DKMS, download the source code:

foc@ubuntu22:~$ git clone https://github.com/whitebatman2/rtl8821CU.git
Cloning into 'rtl8821CU'...
remote: Enumerating objects: 669, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 669 (delta 0), reused 2 (delta 0), pack-reused 666
Receiving objects: 100% (669/669), 3.32 MiB | 1.21 MiB/s, done.
Resolving deltas: 100% (247/247), done.

Go to the directory where the source code is:

$ cd rtl8821CU/

Then run the make command:

$ make

Run the "make install" command with sudo authority:

$ sudo make install
install -p -m 644 8821cu.ko  /lib/modules/5.4.0-122-generic/kernel/drivers/net/wireless/
/sbin/depmod -a 5.4.0-122-generic

Load the compiled module into the system:

$ sudo modprobe 8821cu

You can see the 8821cu module among the installed modules:

$ lsmod | grep 8821
8821cu               1826816  0
cfg80211              708608  1 8821cu

 

Summary

Installing your drivers using DKMS offers a number of benefits to ensure drivers are compatible and up-to-date:

  • You can do dynamic compilation.
  • It provides easy management.
  • Compatible drivers are installed.
  • It provides ease of use.

In case of installation without DKMS:

  • Manual compilation is required.
  • You may encounter update problems.
  • Management difficulties may arise, you need to put more effort.

As a result of this information, the installation choice is yours. Feel free to comment on the problems you encounter.

 

References

https://github.com/whitebatman2/rtl8821CU

 

Views: 448
Omer Cakmak

Omer Cakmak

He is highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment