Getting a USB Wi-Fi adapter working on Linux with an out-of-tree DKMS driver is one of those tasks that looks intimidating until you have walked through it once. I have compiled and reinstalled drivers for more Realtek chipsets than I can count, and I still keep notes because the incantations are easy to forget. This guide walks you through every step, from identifying your chipset to surviving a kernel update without losing your connection.
Many cheap USB Wi-Fi adapters ship with chipsets that the Linux kernel does not support natively. Realtek’s RTL88x2BU, RTL8812AU, and RTL8822BU are common offenders. The hardware works fine, but the driver lives outside the kernel tree, so you have to install it yourself. DKMS makes that installation survive kernel upgrades, which is the difference between a working setup and a frustrating monthly chore.
Table of Contents
What Is DKMS and Why You Need It for USB Wi-Fi Adapters?
DKMS stands for Dynamic Kernel Module Support. It is a framework that automatically rebuilds kernel modules when you install a new kernel version. Think of it as a hook that watches your kernel and recompiles any third-party driver against the new kernel headers.
Linux ships with hundreds of drivers in its source tree. Those are called in-tree drivers, and they get recompiled automatically by your distribution’s kernel package. Out-of-tree drivers live in separate repositories, usually on GitHub. If you install one manually with make and sudo make install, it binds to the kernel you had at that moment. The next time your distribution updates the kernel, the new one will not contain your driver, and your Wi-Fi adapter will silently stop working.
DKMS solves this by registering the driver source with the system. When a new kernel is installed, DKMS detects the change and recompiles the module for it. That is why almost every modern installation guide for an out-of-tree driver on Linux uses DKMS rather than a plain manual install. It is not just a convenience; it is the difference between a one-time setup and a recurring outage.
In-Tree vs Out-of-Tree Drivers: The Core Difference
An in-tree driver lives inside the kernel source. Distributions patch it, maintain it, and ship it with every kernel release. Anyone with a supported chipset plugs in and it works.
An out-of-tree driver lives outside the kernel source. Nobody is paying a full-time maintainer to track every kernel change. The community maintains it on GitHub, and you install it yourself. The trade-off is that you get support for chipsets the kernel ignores, but you take responsibility for keeping it working across kernel updates.
Identifying Your USB Wi-Fi Adapter Chipset
Before installing anything, you need to know which chipset your adapter uses. The same plastic case can hide a different radio between manufacturing runs, so do not trust the sticker on the box. Plug the adapter in, then run:
lsusb
Look for your adapter in the output. The vendor and product IDs you see there are the keys to driver selection. For Realtek chipsets, the ID will typically start with 0bda. The four-digit number after the colon identifies the chipset family.
Common chipsets that need out-of-tree drivers on Linux include:
RTL8812AU – older 802.11ac adapters, dual-band
RTL88x2BU – newer 802.11ac adapters, USB 3.0, the most common offender today
RTL8822BU – 802.11ac with Bluetooth companion chip
RTL8814AU – 802.11ac, higher gain adapters
If your chipset does not appear here, check the output of lspci -k or lsusb -v for the full descriptor. The word “Realtek” in the description is a strong hint.
Once you know the chipset, pick the matching driver repository. The RinCat repository on GitHub covers the RTL88x2BU family. morrownr maintains several forks for different chipset families. Aircrack-ng maintains one for the RTL8812AU. Pick the one that matches your exact chipset rather than grabbing the first match.
Prerequisites: Installing Build Tools and Kernel Headers
You are about to compile a kernel module, which means you need a compiler, the kernel headers, and DKMS itself. The exact package names vary by distribution, but the idea is the same everywhere.
On Ubuntu, Debian, and Linux Mint
Run this command to install the build toolchain:
sudo apt updatesudo apt install build-essential dkms git linux-headers-$(uname -r)
The linux-headers-$(uname -r) part pulls the exact headers for your running kernel. If you skip the kernel headers, the build will fail with a missing-file error that points to linux/version.h or similar. I have hit that error enough times to recognize it on sight.
On Fedora, RHEL, and CentOS
Run:
sudo dnf install kernel-devel kernel-headers gcc make dkms git
Then reboot if you just updated the kernel, so the running kernel matches the headers you just installed.
On Arch Linux and Manjaro
Run:
sudo pacman -S --needed base-devel linux-headers dkms git
If you have a non-stock kernel like linux-zen or linux-lts, install the matching headers package. The build will fail against mismatched headers.
How to Install a USB Wi-Fi Adapter Driver Using DKMS on Linux?
With prerequisites installed, you are ready to install the driver itself. The procedure works for any out-of-tree driver that ships a DKMS config file. I will use the RTL88x2BU driver as the example because it is the most common one I get asked about.
Step 1: Clone the driver repository
Open a terminal and run:
git clone https://github.com/RinCat/RTL88x2BU-Linux-Driver.gitcd RTL88x2BU-Linux-Driver
Pick the repository that matches your chipset. If you have a RTL8812AU, use the Aircrack-ng fork instead. If you have a RTL8822BU, there are separate repositories for that family.
Step 2: Verify the source builds against your running kernel
Before registering the driver with DKMS, do a quick sanity build to make sure your toolchain works:
make
If this throws errors, do not proceed to DKMS. Fix the errors first. Common causes are missing kernel headers, wrong compiler, or a repository that has not been updated for your kernel version.
Step 3: Register the driver with DKMS
Run the DKMS commands to add the source, build it, and install it:
sudo dkms add .sudo dkms build rtl88x2bu/5.6.1sudo dkms install rtl88x2bu/5.6.1
Replace 5.6.1 with the version string the repository uses. You can find it in the dkms.conf file at the root of the cloned directory. The version number changes with each release.
Step 4: Load the module
After DKMS installs the module, load it into the running kernel:
sudo modprobe 88x2bu
Check that it loaded without errors:
lsmod | grep 88x2bu
If the module name does not appear, run dmesg | tail -30 to see what went wrong. The error usually tells you exactly which symbol or header is missing.
Step 5: Verify the adapter works
Run ip link to see your network interfaces. You should see a new wireless interface, usually named wlan0 or wlp3s0u1. If it shows up, your distribution’s network manager should see available Wi-Fi networks within a few seconds.
If nothing appears, the driver may not match your exact device ID. Check the repository’s supported devices list and compare against your lsusb output.
Manual Installation as a Fallback Option
Sometimes the DKMS config file is missing or broken. In that case, you can install the driver manually with make and sudo make install. This is the older method and it does not survive kernel updates, but it works for one-off setups.
From the cloned repository directory:
makesudo make installsudo modprobe 88x2bu
Manual installation is also useful when you want to test a patched driver before committing it to DKMS. I have shipped manual installs to test machines many times when I did not want to risk breaking a working DKMS setup.
The downside is clear: every kernel update wipes the module. If you take the manual route, plan to redo the install after each upgrade, or migrate to DKMS once you confirm the driver works.
Configuring USB 3.0 Mode and Blacklisting Conflicting Drivers
Some users hit a strange issue where the adapter connects but drops every few minutes. The usual culprit is USB mode mismatch. The driver auto-negotiates between USB 2.0 and USB 3.0, but on some chipsets the negotiation fails under load.
You can force USB 3.0 mode by setting a module parameter:
sudo modprobe -r 88x2busudo modprobe 88x2bu rtw_switch_usb_mode=1
To make this persistent, drop the parameter into a config file:
echo "options 88x2bu rtw_switch_usb_mode=1" | sudo tee /etc/modprobe.d/88x2bu.conf
Newer kernels ship with an in-tree driver called rtw88 that can grab the same hardware before your out-of-tree driver loads. If that happens, your adapter will be detected but will not behave correctly. The fix is to blacklist the in-tree driver so your out-of-tree one gets priority:
echo "blacklist rtw88_8822bu" | sudo tee /etc/modprobe.d/rtw88-blacklist.confsudo update-initramfs -u
Reboot after blacklisting. The conflicting module will no longer load, and your out-of-tree driver will take over.
Troubleshooting Common DKMS Driver Problems
Even with a clean installation, things can go wrong. Here are the issues I run into most often, and how to fix each one.
The adapter is not detected at all
Run lsusb and confirm the adapter shows up. If it does not, the issue is electrical, not driver-related. Try a different USB port, preferrably one directly on the motherboard. Avoid unpowered USB hubs.
If lsusb shows the device but no wireless interface appears, the driver version does not support your device ID. Check the repository’s supported devices list.
DKMS build fails after a kernel update
Run sudo dkms autoinstall to force a rebuild against the current kernel. If that fails, check that the kernel headers package is installed for the current kernel. On Ubuntu, that is:
sudo apt install linux-headers-$(uname -r)
Older driver repositories sometimes do not track new kernel releases. When that happens, you need to update the driver source by pulling the latest commit from the repository and re-running the DKMS steps.
Wi-Fi worked, then stopped working after a kernel update
This is the classic DKMS scenario. Run sudo dkms status to see if your driver is registered for the current kernel. If it shows installed for the old kernel but not the new one, force a rebuild:
sudo dkms autoinstall
If the build fails, the driver may need a newer version. Update the source and try again.
Wi-Fi adapter connects but disconnects frequently
Suspect USB power management. Disable USB autosuspend for the adapter by adding a udev rule or by disabling it globally with sudo powertop --auto-tune. The rtw_switch_usb_mode parameter mentioned earlier can also help if the chipset negotiates poorly between USB 2.0 and 3.0 modes.
Compilation fails with “No such file or directory” errors
Missing kernel headers. Install the headers package for your running kernel, as shown in the prerequisites section. The error message often points to a file like linux/version.h or linux/modversions.h, which only exist in the headers package.
Security Considerations for Out-of-Tree Drivers
Out-of-tree drivers are not bad, but they do not get the same scrutiny as in-tree drivers. The in-tree driver ships with every major distribution and is reviewed by hundreds of contributors. An out-of-tree driver on GitHub is maintained by one or two people, and it runs with full kernel privileges.
Stick to repositories with active development, recent commits, and many GitHub stars. Avoid random forks that have not been updated in years. If the maintainer has gone silent, the driver may not track new kernel security patches, which is a real risk on a machine that processes untrusted network traffic.
For laptop users on the road, or anyone passing untrusted Wi-Fi traffic through their adapter, the safer long-term move is to replace the adapter with one that uses a chipset with strong in-tree support. Intel-based adapters tend to have the best Linux support, and many Realtek chipsets now have working in-tree drivers in recent kernels. Check the current kernel status before buying new hardware.
Handling Kernel Updates Without Losing Your Driver
DKMS exists to make kernel updates painless, but you still need to do a few things to keep it that way. Never hold back kernel updates just to avoid rebuilding a driver. The security patches in new kernels matter more than the recompile time.
When a kernel update ships, run sudo dkms status after the update to confirm your driver is registered for the new kernel. If it shows installed, you are good. If it shows added, the build has not happened yet. Run sudo dkms autoinstall to trigger it manually.
On Ubuntu, unattended-upgrades can install kernels automatically. If DKMS autopkg is enabled, the driver rebuilds without intervention. On other distributions, the equivalent hook fires from the kernel package post-install script.
If your driver stops working after a major kernel release, the source may not support the new kernel yet. Wait for the maintainer to publish an update, or pin to the previous kernel until they do. Most chipset families see upstream updates within weeks of a new kernel release.
Frequently Asked Questions
What is DKMS and why do I need it for a USB Wi-Fi adapter?
DKMS (Dynamic Kernel Module Support) is a framework that automatically rebuilds out-of-tree kernel modules when you install a new kernel. You need it for an out-of-tree USB Wi-Fi adapter driver so the module gets recompiled against each new kernel version instead of breaking after every update.
Why is my Linux system not recognizing my Wi-Fi adapter?
Your Linux system may not recognize the Wi-Fi adapter because the chipset is not supported by an in-tree driver. Run lsusb to confirm the device is detected electrically, then install the matching out-of-tree driver through DKMS for your chipset family (such as RTL88x2BU or RTL8812AU).
Why does my Wi-Fi stop working after a kernel update?
Wi-Fi stops working after a kernel update because the out-of-tree driver was compiled against the previous kernel. Run sudo dkms autoinstall to rebuild the driver for the new kernel. If the build fails, install the matching linux-headers package or update the driver source.
How do I fix Wi-Fi not working on Linux Mint?
On Linux Mint, install the build toolchain with sudo apt install build-essential dkms git linux-headers-$(uname -r), clone the driver repository for your chipset, then run sudo dkms add, build, and install followed by sudo modprobe with the driver name. Reboot and the adapter should appear in your network manager.
Can I install a USB Wi-Fi adapter driver on Linux without internet?
Yes, but you need to download the driver source on another machine and transfer it over. Download the repository as a ZIP file from GitHub, copy it via USB stick, extract it, then run the same build and DKMS commands. You still need the kernel headers package, which you can also download as a .deb file and install with sudo dpkg -i.
Conclusion
Getting a USB Wi-Fi adapter working on Linux with an out-of-tree DKMS driver comes down to four steps: identify your chipset, install the build toolchain, register the driver with DKMS, and load the module. Once the driver is installed through DKMS, future kernel updates rebuild it automatically, and your wireless connection survives the upgrade.
If you hit a wall, start with the basics: confirm the device shows in lsusb, confirm the kernel headers are installed, and confirm the driver repository matches your chipset. Most problems trace back to one of those three. When the dust settles, consider whether a future adapter with better in-tree support would save you from this dance entirely. For now, your USB Wi-Fi adapter on Linux with an out-of-tree DKMS driver should be working, and you should be back online.