How to Connect a Linux WiFi Adapter: A Complete Guide

The Linux operating system is renowned for its flexibility and security, but for beginners it can often be a challenge, especially when it comes to connecting to a wireless network. Unlike Windows, where drivers are often built into the kernel automatically, open-source You may need to manually configure your hardware. This is especially true for new or rare network card models that aren't yet supported in the distribution's standard repositories.

The connection process can range from simply enabling a switch in the GUI to complex compilation of kernel modules via the terminal. If you encounter a situation where your computer can't see available networks or your adapter isn't detected by the system, don't panic. Proper diagnostics and a step-by-step approach will resolve the issue in most cases, restoring your internet access.

In this article, we'll cover every step in detail: from initial device diagnostics to manual installation of proprietary drivers. You'll learn how to use standard utilities like NetworkManager And wpa_supplicant, as well as how to troubleshoot dependency issues. Understanding these processes will make you a more confident Linux user.

Diagnostics and identification of the adapter model

The first and most important step is to accurately identify the model of your wireless adapter. Without the exact hardware identifier (Vendor ID and Device ID), finding the right driver will be a matter of guessing. Linux provides powerful tools for viewing the list of connected PCI and USB devices, which cannot be ignored.

To get detailed information about PCI devices (internal cards), use the command lspci, and for USB adapters (external whistles) - lsusbThese utilities display a list of all connected devices, where you need to find lines containing the words "Wireless," "WiFi," "802.11," or manufacturer names like Realtek, Intel, or Atheros.

If the standard output of the command is too short, add the switch -v (verbose) to obtain detailed technical information, including the kernel modules used. It's also useful to check whether the system sees the interface itself, even if it's not running, using the command ip linkThe absence of an interface in the list often indicates a physical malfunction or a complete absence of the driver.

⚠️ Attention: If the team lspci or lsusb If your device isn't showing up at all, check the physical connection. For USB ports, try a different connector, and for internal cards, make sure they're seated securely in the PCIe slot.

It's important to note the exact chipset model, as it determines the installation method you choose. Manufacturers often use the same names for products with completely different components. For example, adapters TP-Link can be based on chips Realtek or MediaTek, and the drivers for them will be different.

📊 What type of WiFi adapter do you have?
Built-in (PCIe/M.2)
USB whistle
External antenna with USB
I don't know / I need to check

Checking for drivers and kernel modules

After identifying the hardware, it's necessary to determine whether the system already has a loaded kernel module to work with it. The Linux kernel contains thousands of drivers, but they aren't always activated automatically. Checking the status of modules is a key step before attempting any manipulation of the repositories.

Use the utility lspci -k or lsusb -vto see which driver (Kernel driver in use) is assigned to the device. If the field is empty or "Kernel modules:" is listed with possible options, but none are loaded, the driver must be installed or activated manually.

For more convenient diagnostics in Debian and Ubuntu-based distributions, there is a utility hw-probe or team ubuntu-drivers devicesThey automatically scan your hardware and report whether the official repositories contain recommended proprietary drivers for your hardware.

Team Purpose Output example
lspci -nnk Information about PCI devices and drivers Kernel driver in use: iwlwifi
lsmod | grep wifi Search for downloaded WiFi modules rtl8xxxu 123456 0
modinfo rtl8812au Information about a specific module filename: /lib/modules/.../rtl8812au.ko
rfkill list Radio interface blocking status Soft blocked: no

Particular attention should be paid to the utility rfkillIt often happens that the driver is installed, but the interface is blocked by software or a hardware switch on the laptop case. The command rfkill list will show the blocking status, and rfkill unblock all will remove software restrictions.

Installing drivers through repositories

The safest and preferred installation method is using the distribution's package manager. This ensures compatibility between versions and automatic driver updates along with the system. Most modern distributions, such as Ubuntu, Linux Mint, or Fedora, already have the necessary packages in their repositories.

For Debian-like systems, first update the package list with the command sudo apt updateThen you can use the search by chipset name, for example apt search rtl8812If the package is found, it will only take a few seconds to install.

☑️ Pre-installation check

Completed: 0 / 1

In some cases, you may need to enable additional repositories. For example, in Ubuntu, some WiFi drivers may require a repository universe. Make sure it is activated in the application sources (software-properties-gtk), otherwise the system simply will not find the required package, even if it exists.

⚠️ Note: When installing drivers from third-party PPAs (Personal Package Archives), always check the repository's last update date. Abandoned repositories may contain versions incompatible with the current Linux kernel.

After installing the package, a reboot or at least a restart of the NetworkManager service is often required. Don't skip this step, as the new kernel module must be correctly loaded into memory. If the internet connection doesn't work after a reboot, check the system logs for module loading errors.

Manually compiling drivers from source code

When there are no ready-made packages in the repositories, manual compilation is necessary. This is the most difficult approach, requiring the installation of development tools (build-essential, git, kernel header files linux-headers). Without these components, compilation is impossible.

Typically, the process involves cloning a GitHub repository, running an installation script, and compiling the module. For example, for popular chip-based adapters Realtek Community repositories are often used, as the vendor does not always provide open source code. Teams make And sudo make install are standard for this process.

What to do if compilation fails?

If you see red error lines during compilation, the problem is most often a mismatch between the kernel version and the driver code. Try finding a fork of the repository that supports your kernel or downgrading your system to an older kernel version via GRUB. Also, make sure the dkms and linux-headers packages for your current kernel version are installed.

It is critical to use the mechanism DKMS (Dynamic Kernel Module Support). It automatically recompiles the driver module when updating the system kernel. Without DKMS, your WiFi will stop working after every Linux update, and you'll have to repeat the process.

When installing manually, monitor the messages in the terminal. Successful compilation usually ends with a message stating that the module has been added to DKMS. After this, you need to run the command sudo modprobe <module_name> for immediate activation without rebooting.

⚠️ Warning: Manually compiling drivers can lead to system instability if the code contains errors. Always create a backup of important data or a restore point (Timeshift) before beginning.

Configuring a network using wpa_supplicant and nmcli

After successful driver installation, the adapter should appear in the system. However, server versions of Linux or minimalist distributions may not have a graphical interface. In such cases, a utility can help. wpa_supplicant and console client nmcli.

Utility nmcli (NetworkManager command line interface) makes life much easier. It allows you to scan networks, connect to them, and manage profiles. For example, the command nmcli dev wifi list will show available access points, and nmcli dev wifi connect "SSID" password "password" will make the connection.

For more fine-grained settings, such as when working with hidden SSIDs or specific encryption methods, a configuration file is used. /etc/wpa_supplicant/wpa_supplicant.conf. Network parameters are entered into it, after which the service is restarted. This is a classic method that works on almost any distribution.

If you are using a static IP address, the settings are made through configuration files in the folder /etc/netplan/ (for Ubuntu) or /etc/network/interfaces (for Debian). Incorrect syntax in Netplan YAML files is a common cause of connectivity loss.

nmcli command Action Description
nmcli r wifi on Turn on WiFi radio Activates the adapter
nmcli d wifi scan Network scanning Shows available SSIDs
nmcli c show Show connections List of saved profiles
nmcli c delete "Name" Delete profile Clears network settings

It's important to remember the priority of network managers. If you have several running at the same time, NetworkManager And systemd-networkd (or wicd), they may conflict when attempting to manage the same interface. In such cases, it is recommended to disable unnecessary services.

Solving common problems and conflicts

Even with the correct driver installation, errors can still occur. One of the most common issues is a module conflict. For example, for some cards Realtek The kernel may contain an open-source driver that performs worse than the proprietary one. In this case, it's necessary to add a blacklist for the unnecessary module.

For blacklisting, create a file in /etc/modprobe.d/, For example blacklist.conf, and add the line blacklist module_nameThis will prevent the kernel from loading the problematic driver at startup. After this, be sure to run sudo update-initramfs -u and reboot.

Another common issue is power saving. Linux can aggressively disable the WiFi adapter to save power, leading to connection drops. This can be disabled in the settings. TLP or NetworkManager, adding the parameter wifi.powersave = 2 into the configuration.

⚠️ Note: Interfaces and package names may vary depending on the distribution version. Always consult the official documentation for your specific Linux release, as Netplan or systemd configuration methods may change.

If all else fails, try upgrading your system kernel. Sometimes newer or older LTS kernels offer better support for a specific chipset. Install the package mainline or use the GRUB menu to select a different kernel version at boot.

Don't forget to check the logs: dmesg | grep wifi or journalctl -u NetworkManagerThese commands display error messages in real time, allowing you to pinpoint the cause of the failure—whether it's an incorrect password, a missing DHCP server, or a driver failure.

Why does the adapter disappear after sleep?

Problem restoring power to USB or PCIe ports after sleep. Solution: Disable autosuspend for USB in the TLP settings or add the kernel parameter usbcore.autosuspend=-1.

Frequently Asked Questions (FAQ)

How to connect to WiFi without a GUI (console only)?

Use the utility nmtui (NetworkManager text interface) for easy connection via the menu. If you don't have it, use the link ip link set wlan0 up to raise the interface, iwlist wlan0 scan to search for networks and wpa_supplicant for authorization.

Where can I get a driver if I don't have internet access?

Download the required package (.deb, .rpm) or driver source code on another device (phone, another PC). Transfer the file to the Linux machine via a USB drive. For transferring from Android, you can use apps like "WiFi File Transfer" or simply a USB cable.

Why does the sudo modprobe command give a "Module not found" error?

This means the module isn't loaded into memory and most likely isn't installed on the system. Make sure you've successfully compiled the driver or installed the package. Also, check that the module name in the command matches the actual driver filename (without the .ko extension).

Can I use an Android smartphone as a WiFi adapter for Linux?

Yes, this is possible using USB tethering. Connect your phone via USB, enable tethering in Android settings, and Linux will detect it as a wired Ethernet connection (RNDIS/ECM), allowing you to download the necessary drivers for the primary adapter.

How to permanently disable IPv6 if it is causing WiFi problems?

Create a file /etc/sysctl.d/10-disable-ipv6.conf and add the lines: net.ipv6.conf.all.disable_ipv6 = 1 And net.ipv6.conf.default.disable_ipv6 = 1. Then apply the changes with the command sysctl -p.