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
, theniw 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?