Installing Realtek Drivers on Kali Linux: A Complete Guide for WiFi Adapters

Working with wireless networks in Kali Linux often begins with an unpleasant surprise: the built-in Wi-Fi module doesn't support monitor mode or isn't detected by the system at all. This is especially true for popular chips. Realtek, which are widely used in USB adapters. Unlike standard distributions, Kali requires specific header files and compiled kernel modules to function correctly.

The problem is that many manufacturers don't provide open-source drivers, and standard Linux repositories don't always contain up-to-date versions for new devices. You'll have to build the package yourself from source code to utilize the full potential of your hardware. For packet injection and monitoring modes, it is critical to use drivers that support these features, rather than just basic client mode operation.

In this article, we'll walk you through a detailed workflow that will enable you to turn any compatible adapter into a powerful security audit tool. We'll cover environment preparation, device ID search, and the compilation process, avoiding common errors that can cause system freezes.

Preparing the environment and checking compatibility

Before starting any manipulations, ensure your system is fully updated. Missing kernel headers is the most common cause of driver compilation errors. Update your package database and install the necessary compilation tools, such as gcc and make.

sudo apt update

sudo apt full-upgrade -y

sudo apt install -y linux-headers-$(uname -r) build-essential git dkms

After installing the basic components, you should check whether the operating system even recognizes your device. Connect the adapter and use the lsusb utility to list connected USB devices. Find the line containing the name of the device in the list. Realtek or a specific chip identifier.

Please note the manufacturer and product code, e.g. 0bda:8812These numbers are the key to finding the right driver. If the device is shown as "Unknown" or not shown at all, try switching it to a different USB port, preferably USB 2.0, to rule out power or controller issues.

⚠️ Warning: Make sure you're using the correct headers for the currently running kernel. Installing packages for a different kernel version will prevent the module from loading.
πŸ“Š What chipset does your adapter have?
RTL8812AU
RTL8821AU
RTL8822BU
RTL8723DS
I don't know / I'll look in lsusb

Chipset identification and driver search

Determining the exact chip model is the foundation for a successful installation. Many adapters from different brands (TP-Link, Alfa, Edimax) are built on the same components. RealtekHowever, firmware versions may vary, so it's important to select a driver tailored to your specific series.

There are several popular GitHub repositories that contain customized versions of drivers for Kali. Community projects that support the mode are considered the most stable. monitor And injectionFor older models, standard packages from repositories are often suitable, but for newer chips, you'll have to download the source code manually.

  • πŸ” RTL8812AU: The most popular chip for pentesting, requires drivers that support AC standards.
  • πŸ“‘ RTL8821AU: A budget option, often found in compact whistles, requires careful assembly.
  • πŸš€ RTL8822BU: Modern dual-band chip provides high speed and stable connection.

If you are unsure of the model, use the command dmesg | grep usb Immediately after connecting the device. The last lines of the output contain detailed information about how the kernel detected the device and which driver it attempted to load automatically.

Installing drivers via DKMS

The DKMS (Dynamic Kernel Module Support) method is preferred because it automatically recompiles the module when the system kernel is updated. This eliminates the need to repeat the installation procedure after each major Kali Linux update.

The process begins with cloning a GitHub repository. Choose the repository that matches your chipset. For example, the 8812au series often uses forks that support new kernel versions. After cloning, navigate to the source code directory.

git clone https://github.com/morrownr/8812au-20210629.git

cd 8812au-20210629

Next, run the installation script. Most modern repositories have an automated script. install-driver.sh, which will automatically detect the kernel version, copy files to the required directories, and register the module in DKMS. Running requires superuser privileges.

⚠️ Warning: If the installation script fails, do not attempt to run it again without cleaning it. First, run the uninstall command if the old module was partially installed.

β˜‘οΈ DKMS Installation Checklist

Completed: 0 / 4

Manual compilation via Make and Install

In cases where DKMS is unavailable or you're using a custom kernel build, you'll have to resort to manual compilation. This method is more labor-intensive and requires repeating the steps after each kernel update, but it gives you complete control over the process.

First, you need to clean up any remaining compilation artifacts. Then, the module build process begins. The gcc compiler converts the C source code into a binary kernel module (.ko file) compatible with your OS version.

sudo make clean

sudo make

sudo make install

After successfully compiling and installing the files into the system directories, you must manually load the module into memory. The module name usually matches the driver name, for example, 8812au or rtl88x2buYou can check the download via lsmod.

It is important to note that when installing manually, the system will not be aware of the module's dependency on kernel updates. Automatic reinstallation In this case, it will not happen, and after upgrading the system, WiFi may stop working until manually recompiling.

What should I do if make returns "Error 2"? This most often indicates missing build tools or kernel headers. Check that the linux-headers-$(uname -r) package is installed correctly for your current kernel version. This error can also occur if there is a conflict between gcc versions.

Compiler version conflicts often occur during compilation. Make sure the standard build-essential toolset is installed.

Module conflicts and blacklisting

A common problem is a conflict between the driver you're trying to install and the driver the system loaded automatically. The Linux kernel often tries to use the default driver. rtlwifi, which may not work stably or may not support the required functions.

To resolve this, you need to blacklist the conflicting module. This will prevent the system from loading it at startup. Blacklist configuration files are located in the directory /etc/modprobe.d/You can create a new file, for example, blacklist-realtek.conf.

Conflicting module Target driver Action
rtl8xxxu 8812au Add to blacklist
rtlwifi 8821au Add to blacklist
rtw88_8822bu 8822bu (custom) Add to blacklist

After making changes to the configuration files, you need to update the initramfs so that the changes are applied early in the system boot process. The command update-initramfs -u will complete this task. Without this step, the system may continue to load the old module until a complete system reinstallation.

Operation check and monitoring mode

The final step is to verify the installed configuration. Restart the computer or reconnect the adapter. Use the command ip link or iwconfigto make sure that the interface has appeared in the system and has the correct name, for example, wlan0.

To test the pentesting functionality, you need to check for support for monitoring mode. Try switching the interface to this mode using the airmon-ng utility. Successful interface creation wlan0mon indicates that the driver is working correctly.

sudo airmon-ng start wlan0

sudo iwlist wlan0 scan

If the network scan is successful and you see a list of available access points with their channels and signal strengths, then the installation was successful. Your adapter is now ready for further use in tools like Aircrack-ng or Wireshark.

What should I do if the adapter disconnects when I start scanning?

This is a classic sign of insufficient power. The USB port may not be delivering enough current to operate the adapter in active mode. Try using a powered USB hub or connecting the adapter directly to the motherboard port, bypassing the front panel of the case.

Can these drivers be used in VirtualBox or VMware?

Yes, but with limitations. You'll need to forward the host's USB device to the guest OS. However, for monitoring and injection modes, USB forwarding through a virtual machine is often unstable due to latency and timing issues. It's recommended to use a Kali Live USB or a bare-metal installation.

Why did WiFi stop working after updating Kali?

Most likely, the Linux kernel was updated and the DKMS module failed to rebuild automatically, or you used manual installation. Check the dmesg logs for module errors. Rerunning the driver installation script for the new kernel version usually helps.