3

When waking from sleep, sometimes my Linux laptop won't reestablish it's Wi-Fi internet connection.

Interestingly, rebooting fixes it, although it's kind of a pain to have to do a full shutdown/reboot.

In other words, when coming out of sleep, sometimes my HP Debian Buster v10.4 laptop fails to reconnect to my home access point. This occurs at a rate, very roughly of about 1 out of every 6 sleepovers or so.


After noticing that the Wi-fi is down, clicking on rescan for wireless networks does not fix it. Also, iw wlan0 scan, (or explicitly iw dev wlan0 scan) gives: 'command failed: Network is down (-100)'.


Carefully studding the output of journalctl -n 1000 -u NetworkManager -u wpa_supplicant I can see that very soon after the line: "NetworkManager state is now ASLEEP" (i.e. when waking up), the first trouble appears to be at a line that says: "device (wlan0): supplicant interface state: completed -> disabled".

I think this should have been rather, "... completed -> disconnected", which appears in working wake-ups, i.e. when WI-fi properly works again after waking up.

What doesn't fix it:

  • Logout and log back in;
  • Sleeping and waking up again,
  • Hibernating and then waking back up from that
  • Restarting Network Manager (with $ sudo systemctl restart NetworkManager.service)
  • Running $ sudo nmcli networking on
  • Deleting and recreating the wlan0 network device with: iw dev wlan0 del, then iw phy phy0 interface add wlan0 type managed addr ca:xxx:4b. Even though this appeared to work, wi-fi still does not.

I've also checked that $ rfkill list doesn't report any blockages.


Here's the status report from nmcli when in a failed (internet down) state. Notice the GENERAL.STATE below. (I've obfuscated real addresses.)

$ nmcli device show wlan0
GENERAL.DEVICE:                         wlan0
GENERAL.TYPE:                           wifi
GENERAL.HWADDR:                         00:26:##:##:##:2A
GENERAL.MTU:                            1500
GENERAL.STATE:                          20 (unavailable)    <-- this is not right
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
...

Also, here's the status report from a normal working wifi connection:

$ nmcli device show wlan0
GENERAL.DEVICE:                         wlan0
GENERAL.TYPE:                           wifi
GENERAL.HWADDR:                         00:26:##:##:##:2A
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)     <--- this is when it works
GENERAL.CONNECTION:                     Auto NETGEAR14
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]:                         192.168.1.128/32
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE[1]:                           dst = 192.168.1.128/32, nh = 0.0.0.0, mt = 600
IP4.ROUTE[2]:                           dst = 192.168.1.1/32, nh = 0.0.0.0, mt = 600
IP4.ROUTE[3]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.ROUTE[4]:                           dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 600
IP4.DNS[1]:                             192.168.1.1
IP6.ADDRESS[1]:                         fe80::...:7f2a/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 600
IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255

Any ideas? Is there a way to reinitialize the phy0 radio driver?

2 Answers2

3

The best way to debug this by checking the system log messages at around the time your connection disappears:

journalctl -n 1000 -u NetworkManager -u wpa_supplicant

NetworkManager does not directly use the kernel Wi-Fi APIs, it relies on wpa_supplicant for this. It could be that wpa_supplicant.service is wedged up, or keeps crashing, or is conflicting with another Wi-Fi tool (e.g. iwd, connman, or a different wpa_supplicant instance accidentally launched by another app).

You can increase the verbosity of NetworkManager by running:

nmcli gen log level debug

and of wpa_supplicant by running:

busctl set-property fi.w1.wpa_supplicant1 \
                   /fi/w1/wpa_supplicant1 \
                    fi.w1.wpa_supplicant1 DebugLevel s debug

Additionally, try to completely bypass NM & w_s and directly ask the kernel to scan for networks – if it works, the problem is likely to be on the userspace side; if it doesn't, it's likely on the driver/hardware side:

iw wlan0 scan
grawity
  • 501,077
0

Try replacing your WI-FI card (hardware).

It cost me about $20 for a new one, and it's fairly easy to find inside your laptop, (search for help on you-tube). I got the part# right off of the old card. You'll need some small watch type screwdrivers.

It's been two months since getting the new card and problem is gone.

Mine looked like this:

enter image description here