Diagnosing Wifi and Bluetooth issues on Linux
So first we need some information Let's find out what hardware you have first. Start by entering this command, it's safe to paste into a terminal (but remember you normally shouldn't do that) lspci | grep Network && lsusb | grep Bluetooth && rfkill This runs 3 commands, and pares their output down to be...
So first we need some information
et’s find out what hardware you have first.
Start by entering this command, it’s safe to paste into a terminal (but remember you normally shouldn’t do that)
lspci | grep Network && lsusb | grep Bluetooth && rfkill
This runs 3 commands, and pares their output down to be more readable. lspci as the name implies, is the ls command, but for PCI devices. The same for lsusb. This means we are going to “List” these devices on screen. But that’s a huge list of stuff, way more than we need, so we need to trim the output. So we’ll pipe the output (| <- that symbol is a pipe symbol) into grep (think of this as a search function, the name is derived from the ed commands to do the same, g/re/p) and use that to search for the words “Network” and “Bluetooth”. Finally, we will run rfkill, which as the name implies is used for controlling activation of “RF” devices, “RF” in this case referring to radio and other wireless protocols.
After running this command, you should have an output that looks kinda like this:
╭─nora at nBell in ~ 26-09-06 - 8:55:21
╰─○ lspci | grep Network && lsusb | grep Bluetooth && rfkill
0a:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)
0b:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)
Bus 001 Device 006: ID 8087:0029 Intel Corp. AX200 Bluetooth
ID TYPE DEVICE SOFT HARD
0 bluetooth hci0 unblocked unblocked
1 wlan phy0 blocked unblocked
Don’t worry if yours doesn’t look exactly the same, for example, I have my wifi disabled at the software level, so it shows blocked under the SOFT column, you probably won’t (unless that’s why you’re here of course).
So we have information, now what do we do with it?
First, check if anything is blocked. If it is, that’s the issue! Check the device ID that is blocked (under the ID column), and run the following command (substituting your device ID where instad of %ID%)
sudo rfkill unblock %ID%
Your machine might not ship with sudo, in that case you can swap in doas to see if that will work. If not, you’ll need to act as root, so you’ll enter a series of commands to give admin control, perform the action, then leave the admin privileged shell (never perform actions as the admin that you don’t need to, it’s a great way to break things, this separation of privileges helps to keep Unix-like systems safe and secure from tampering. The commands to do this are as follows:
su root #technically you don't need to add root here, but it's good practice.
rfkill unblock %ID% #Remember to swap %ID% to the correct id number.
exit #Never stay in the root shell longer than you absolutely have to.
In most circumstances, your problem is probably fixed now! Go ahead and try to connect your wifi or Bluetooth.
But Nora, it’s still broken, what do now?
Often times, especially on distributions that are meant to be “New user friendly”, there’s a particular super mega important package that doesn’t get updated when you update your kernel. I’m not sure why, you’ll have to ask the Debian/Ubuntu/Mint maintainers. If I had to guess it’s something to do with the way the Apt package manager handles upgrades, since non-debian based systems seem to handle this fine. Whatever, I digress: we’re fixing your wifi/Bluetooth, not complaining about Apt.
So lets check some things. We know everything is unblocked. We know you have probably just updated your system (otherwise why would something have failed?). This means there’s probably a mismatch between your Kernel (which you just updated) and the rest of your system. There’s a special package called linux-headers that teaches your kernel how to communicate with the userspace programs and drivers, if there’s a mismatch things will probably work fine, but there’s also a decent chance that something changed that will make them not play nice together anymore, so for example Kernel 6.0.1 won’t play with linux-headers 5.1.4
That’s great Nora, what the hell do I do with this information though?
Time to do some cross referencing.
Run the following command:
dpkg --list | grep linux-headers && uname -r
The version numbers coming from each of those should be the same. If it’s not, ding ding ding we found the problem. If there’s only one number ding ding ding we found the problem. Luckily, they’re both solved the same way!
We need to install the linux-headers package that matches your kernel.
In my case, I’m using kernel 7.2.2, so I would install linux-headers-7.2.2
You’ll need to run the following:
apt search linux-headers
Copy the package name (everything before the / symbol) that matches your kernel version (remember we found that out with uname -r) to your clipboard. You can do this by highlighting the name with your mouse, selecting “Edit” and clicking “Copy”. On most machines you can also copy by pressing “Ctrl+Shift+C
Then you can run:
sudo apt install %Paste Package Name Here%
Once that finishes installing, reboot the machine and you should be golden.
If you’re still experiencing issues you’re beyond what I can offer device agnostic assistance for. That very first command we ran earlier tells you what exact wireless hardware you’re working with. Take a look to see if there’s a special driver needed for it. Broadcom devices in particular are picky about which driver you use, you may need to use b43 or bcmwl. If you’re on an Apple machine, look for an Apple hardware specific guide, the ArchWiki has a great write-up on apple machines which would be worth looking at, but remember that not every command from there will work on your Debian based machine and you’ll need to make some creative adaptations to fit your use-case.
I hope this helped, if not, please leave a comment below and I’d be happy to assist you! I can offer assistance in English or German, other languages I’ll need to use translation services so you’d probably be better off asking someone else.
Did you enjoy this article?
Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.