Wi-Fi Not Working in Linux? Here’s How to Fix it

Linux Wifi Not Working Feature

One of the big challenges that users tend to face with Linux is Wi-Fi. Wi-Fi drivers are often not included in the kernel, and as a result, there are many issues getting non-Intel Wi-Fi modules to work well under Linux. Here we cover what happens when Wi-Fi isn’t working on Linux and how to fix it.

Also read: How to Move Your Home Folder to Another Partition in Linux

Hardware vs. Software Wi-Fi Issues

A Wi-Fi connection issue can be either a hardware or software issue. Hardware issues are relatively easy to diagnose – all you have to do is to open the terminal and enter the following command:

ping localhost
Linux Wifi Not Working Ping Localhost

This is a simple way to check if your physical hardware is working. localhost works as an address to check the circuitry for your NIC. If this isn’t working, you may need to have some work done on the hardware, whether by yourself or from someone else.

If that ping comes back clean or you don’t even see your Wi-Fi card, you likely have a software issue.

Install Drivers from Ubuntu ISO

If your distro isn’t detecting your Wi-Fi network at all, or if you’re getting errors, then you can try installing or reinstalling the Wi-Fi drivers from the Ubuntu ISO file. First, you need to download the Ubuntu ISO corresponding to your Ubuntu version. (Presumably, you need to download it on a different device or download it using your Ethernet connection on Ubuntu.)

Place the Ubuntu ISO into the Home directory on Ubuntu. Then in the Terminal, enter the following sequence of commands to mount the Ubuntu ISO to a virtual drive:

sudo mkdir /media/cdrom
sudo mount -o loop ubuntu-*.iso /media/cdrom

Go to “Software & Updates” from the dashboard, then in the new window, check the “CDrom with [your distro name and version] box” and enter your password when requested.

Click the “Additional Drivers” tab, then select the “Wireless Network Adapter” option and click “Apply Changes.”

Also read: How to Set Up Bluetooth in Linux

Issue One: Device Not Detected

If the wireless device is not detected by Ubuntu (or any distro for that matter), then you will need to access the Terminal and type the following command:

sudo lsusb

if you use a plug-in USB wireless card/dongle and

Linux Wifi Not Working Lsusb
sudo lspci

if you have an internal wireless card.

If the response from these commands comes back with an output similar to the screenshot below, then you are in luck: Ubuntu can find the card. It is usually identified by “Network Controller” or “Ethernet Controller.”

In the past, many Linux distributions have had difficulty finding the wireless card. Thankfully, support has gotten much better, so this is now a rare instance.

Additional Commands

You can also use the following command to test if the machine can see the wireless device; users may need to install lshw on their machine first.

sudo lshw -C network
Linux Wifi Not Working Lshw

The output should resemble something similar to this:

*-network
description: Wireless interface
product: PRO/Wireless 3945ABG [Golan] Network Connection
vendor: Intel Corporation

If this is the case, and the system finds the wireless card, you can proceed to installing the driver/module as described below.

Also read: How to Enable Wake-on-LAN in Ubuntu

Issue Two: Driver Module Missing

Following on from the successful lsusb and lspci commands, providing your Linux distro can see the wireless card, you can assume that the firmware is working, just that the system has no idea what to do with the card. This is where drivers or modules are needed.

Go back to the terminal and type the following command:

sudo lsmod

You will see a list of modules that are used. In order to activate your module, type the following command where “modulename” is the name of your chipset.

sudo modprobe modulename

For example, if your wireless chipset is “RT2870,” it would be as follows:

sudo modprobe rt2800usb
Linux Wifi Not Working Modprobe

After this, run the lsmod command again to see if it has loaded correctly.

Load Module Automatically at Boot

It is a rare occasion, but sometimes the module will not persist from boot. In this case, you can force it to load permanently. Enter the command below into the Terminal:

sudo nano /etc/modules

The nano text editor will open. Add your module name at the bottom and save the file. You will need to reboot and check to see if the wireless card can now see networks to enable you to connect as normal.

If you get stuck, then repeat the process. Thankfully, Ubuntu has some useful help pages in its online documentation that you can also read through. Additionally, you can use the built-in help within the terminal by entering:

man lsusb
man lspci

Issue Three: DNS

It is rare that the DNS will be an issue; however, it is worth investigating should you still have connection issues. From the Terminal, type the following command to assess where the DNS is coming from:

nmcli device show wlan1 | grep IP4.DNS

This will show you the LAN address of the router. If it doesn’t work, you may have to change “wlan1” to whatever your wireless uses. The following command can also be used to grab the designation:

ip a s

Once you have this information, your next method is to ping your router’s LAN address. If this works, try to ping Google’s DNS servers:

ping 8.8.8.8

With these results, you can establish where the DNS issue is. If all devices within your home or office are giving page load errors, then change the router DNS to Google or Open DNS servers. You’ll have to consult your router manufacturer for how to do this, but it is generally done within the admin pages, most commonly by logging onto 192.168.0.1 or similar.

If your DNS issue is Ubuntu only, then follow these steps by using the Network Manager GUI:

  • Right click on Network Manager.
  • Edit Connections.
  • Select the Wi-Fi connection in question.
  • Select IPv4 Settings.
  • Change Method to DHCP Addresses Only.
  • Add 8.8.8.8, 8.8.4.4 into the DNS server’s box. Remember the comma separating the IPs and don’t leave spaces.
  • Save, then Close.

As a final step, either restart your machine or restart the Network Manager from the Terminal:

sudo service network-manager restart

Issue Four: No Network Manager

Let’s say you have removed the Network Manager or uninstalled it by accident. This is a really troublesome situation: you have no Internet and no Network Manager, but there are things you can do.

Assuming the package is still within your cache, you can go to the Terminal and enter:

# Debian/Ubuntu
sudo apt install network-manager
 
# Fedora
sudo dnf install network-manager
 
# Arch Linux
sudo pacman -Syu network-manager

If you have removed this cache, then you can use an Ethernet cable to connect by plugging this into your Ethernet port and running the above command again.

As a final step, if none of the above works, you will need to edit your configuration file. I selected gedit as the text editor, but you can use your preferred choice and amend the command.

sudo gedit /etc/network/interfaces

Amend it to read as follows:

auto lo
iface lo inet loopback
 
auto wlan0
iface wlan0 inet dhcp
wpa-essid myssid
wpa-psk mypasscode

Then you can restart the interface by entering the below code:

sudo ifdown wlan0 && sudo ifup -v wlan0

Further reading of the Linux Wireless subsystem can be found on the kernel.org wiki.

With your Wi-Fi now up and running, why not celebrate by looking at the best ways to play Windows games on Linux? Or, if you don’t know all the ways you can rename files in Linux, then check out our guide on it.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

John Perkins

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.