22

I just recently installed Ubuntu 20.04 (clean install, dual boot from windows) and the wifi keeps dropping out. It was previously stable under windows and from other computers in the house so I don't believe it's an issue with the router or the actual internet connection.

I tried reinstalling the broadcom drivers according to Installing Broadcom Wireless Drivers which recommended the bcmwl-kernel-source drivers but that hasn't helped resolve the issue.

I'm still quite new to the linux game so if someone would be able to have a look at the wireless diagnostic scripted linked: https://paste.ubuntu.com/p/R4PMFVTvDT/

Thank you so much for you help!

  • I had the same problem in 22.04. Solved it by manually selecting the 2.4 GHz band. It must have been trying to use the 5 GHz band and tripping over itself. – Kyle Feb 16 '23 at 22:32

10 Answers10

23

I was in a similar situation since two weeks and I found a solution yesterday (11th May) which is working so far (dual boot Ubuntu 20.04 / Windows, wireless card Broadcom 4325).

Surprisingly, my issue was not due to wireless driver or power management (tried many things in previous days, no improvement) but related to the ARP entry of my computer expiring on my local router (ARP stands for Address Resolution Protocol, it makes translation beetween IP addresses and MAC addresses).

To make it short (investigation details at the end of this answer) :

  • The ARP entries of my router have a timeout of 20 minutes,
  • For my computer it was decreasing up to expiration (which made me lose connection every 20 minutes),
  • And the same for other devices but for them it was automatically refreshed before expiring. I made network captures to find out what these devices were doing differently and found that their timeout is refreshed when they send an ARP request.

=> A solution appeared, I had to tell my computer to do the same ! (send ARP request)

Implementation of the solution

To send an ARP request, I used arping that you can install from its package :

sudo apt install arping

When you launch it, it says that it must run as root or with the cap_net_raw capability. Since I didn't wanted to launch it as root, I added the capability :

sudo setcap "cap_net_raw+ep" /usr/sbin/arping

I used the following command to send one ARP Request to my router (replace the IP address with the one relevant for you) :

arping -c 1 192.168.1.1

Then I wanted this command to run every 15 minutes to refresh the ARP entry regularly. This is done by editing the file /etc/crontab :

sudo vi /etc/crontab

And adding this line at then end of the file :

*/15 * * * * <username> arping -c 1 192.168.1.1

That will make the ARP request sent every 15 minutes.

Detailed investigation process

Here are more details on how I discovered the issue :

  • Developped a widget telling me with timestamps when the connection is lost, and when it comes back.
  • Running a tcpdump capture until a disconnection/reconnection happens (purpose of the widget).
  • In the capture, found ARP messages around the issue time.
  • Looked into the ARP table of my pfSense router and saw that the timeout entry for my PC was always decreasing until expiration ; for other devices connected it decreased also but at some point it was resetting to default value (1200s in my case) before expiration.
  • Waited until expiration to confirm I observe the disconnection symptom on my computer (yes).
  • Made tcpdump captures on the router to see how others devices were successfully resetting their timeout : by sending ARP requests before it expires.
  • Installed arping as explained above and sent a test ARP request to the router : it resetted my expiration timeout to 1200s, victory ! \o/

Finally, I don't know why I never faced this issue when using Windows. When checking the ARP table I see the entry becoms expired as well but then immediately get resetted to 20 minutes and I cannot see a network disconnection.

You may also wonder how to check the ARP table. If you are using a pfSense router, it can be found in the submenu "Diagnostics > Table ARP" (to be translated in English, my menus are in French). With another device, you will have to check its documentation.

But at the end, event if you can't check the ARP table you can still try to insert the line in /etc/crontab and run it for a couple of hours/days. If your problem doesn't reappear then it was the issue :-)

Hope this helps !

  • 4
    Nice answer. Thanks a lot. If you run echo "*/15 * * * * \whoami` arping -c 1 `ip route show | grep -i 'default via'| awk '{print $3 }'`" |sudo tee -a /etc/crontabthe configuration line is automatically appended to/etc/crontab` with your username and router IPv4 address. – Yuri Sucupira Dec 14 '20 at 08:31
7

I had the same issue. After a little google search, I found a few answers after checking dmesg. So, after running:

# dmesg -w

I found this message error:

wlan0: deauthenticated from c8:e7:xx:xx:xx:xx (Reason: 6=CLASS2_FRAME_FROM_NONAUTH_STA)

I found the meaning of the error in Linux WiFi: Deauthenticated Reason Codes:

Class 2 frame received from nonauthenticated STA Client attempted to transfer data before it was authenticated.

After identifying the error, I need to understand why my old MacBook White was getting a kick from my AP (the connection was online, but no packets in/out).

Well, the error shows me enough to understand the issue. The error is about an authentication error with Access Point, after that, I understand that my AP was "kicking" my connection and denying the packets from the Wi-Fi interface.

So, let's try something.
Maybe if I stop the automatic channel/frequency change the issue is over... After changing my AP configuration to the static channel (36) and frequency to (80Mhz) the Wi-Fi interface stop drop and the issue is over (so far so good), so no more instability with Wi-Fi connection using Broadcom (BCM4321).

What did I understand about the error?

I guess the firmware has some code issue with the authentication after auto-negotiate the channel and frequency, the firmware send the authentication request before the connection really finishes the "handshake" with the AP.

I hope this "workaround" helps you with the issue.

4

I took the top answer and comment and improved it by moving the router's IP lookup into a script run by cron. This way the solution will work even if you use multiple different wifi networks.

Put the following into a script (i.e. /home/<username>/bin/arping-router.bash):

arping -c 1 `ip route show | grep -i 'default via'| awk '{print $3 }'` | head -n 2 | logger

This will also log the even to syslog, so you can confirm it is running.

You also need to do the following:

chmod +x /home/<username>/bin/arping-router.bash

sudo apt install arping sudo setcap "cap_net_raw+ep" /usr/sbin/arping

sudo vi /etc/crontab

Add this to the end of the file:

/15 * * * <username> /home/<username>/bin/arping-router.bash

abhyuday
  • 3
  • 2
ddiepo
  • 41
2

By checking your log it is recommended to disable power management for wifi as wl/b43 driver have described here then edit: /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

wifi.powersave = 2

[EDIT] it appers, that in my case after further testing that changinf this parameter made the sitation worse as the wifi is bouncing more and more due to repeated wifi scan ... So if you have a problem, don't use this. (you might not have the problem though if you are using wl driver. I'm using b43 in my case.)

  • Thanks for going through my log. I've just tried apply this edit to the conf file. Hopefully it'll work. All the best with going about fixing your wifi issues as well. Chers. – Yoomes Bond Apr 27 '20 at 05:15
2

I also get the same issue,

To fix, i reload the wireless kernel module

sudo modprobe -r wl && sleep 5s && sudo modprobe -a wl
Cipher
  • 21
  • 3
2

I ran into the same issue. I tried most of those complicated solutions, which didn't work. after some hours of debugging, in my case it was caused by a single SSID/network for both 5 GHz and 2.47 GHz, the Ubuntu driver just couldn't handle it properly.

You can try going to your router's IP (usually printed on the label), and changing each one of them to another SSID and channel.

Changing SSID and channel depends on the router's manufacturer, but here is an example how-to for a NOKIA router: How to enable separate SSIDs for 5GHz and 2.4GHz.

To setup a separate SSID for either 2.4 GHz:
(The process can be adjusted for 5 GHz.)

  • Connect to your Nokia WiFi network with a web browser using either http://www.webgui.nokiawifi.com or http://192.168.18.1/ (wireless connection or wired are both fine)
  • You will see the login window. The default user name is 'admin'. The default password is on the sticker on the bottom of your root Wi-Fi point.
  • After you are logged in, click on "Network" from the top menu.
  • Then click on "Wireless (2.4 GHz)" from the sub-menu on the left.
1

I have had the same issue. I have a broadcom 4313 wireless card that drops connection when it was basically downloading large files for long periods of time.

So far this resolved my issue:

https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx

If you need a quick guide, I recommend fixing it via removing all the drivers first using the command name sudo modprobe -r drivernamegoeshere then adding them back in one at a time to see if what works.

To get the list of drivers. lsmod | grep cfg80211 then remove each one and add one of them back in (start with b43) with sudo modprobe b43. So far, this is working out for me.

0

I'm using Ubuntu 20.04 at this time. Due to some issues, I use usb wifi adapter which is https://www.tp-link.com/us/home-networking/usb-adapter/tl-wn823n/.

Since I dual-boot from Windows and this wifi adapter works normally in there, I expect that this could also works in Ubuntu (not to mention that the website said it is "compatiable" to linux); however, my connection is so unstabled that it disconnect regularly. After doing A LOT of research and experiments including building backport-iwlwifi and kernel library, changing setting of wifi-power etc, these methods didn't really fix my issues.

It comes out that the real problem occurs on the KM driver of my chipset, which is RTL8xxxu. You could check your KM driver by

sudo lshw -c network

and see the configurations. After following procedures on https://www.ravendevelopers.com/blog/2020/09/installing-wireless-usb-linux-rtl8xxxu-chipset , my connection suddenly recovered and being so stable. So if methods mentioned above don't solve your problem, maybe you could install another driver and replace the default one.

0

Forgive the necrobump. After trawling and trying various things for the hp elitebook 640 g9 on ubuntu, the fix looks to have been updating the BIOS.

user171095
  • 21
  • 2
-1

Got into the same issue. It seems to me related to wifi-power-save-on feature. If I turn it off, the Wi-Fi interface goes to airplane mode, which means no Wi-Fi at all... NICE.

So, the simplest and stupidest solution was to run the endless ping to the router in background. This is enough to make the Wi-Fi alive.

Solo
  • 1