I'm running Ubuntu LTS 22.04 on a laptop that acts as a server.
Since a couple of days I keep losing my wi-fi connection whenever my laptop screen turns off.
The screen is turned off in the power settings after 2 min to save power as it is mostly just working as server, but the laptop is not switched to low-power mode as long as the laptop is powered from the adapter. (normal situation)
(It has been running stable in this way since the installation around the time that 22.04 was released and did not show any issue until now.)
Whenever I move the mouse the wi-fi connection gets re-established and the server works as expected again.
The problem is that now the server obviously does not function because it is unreachable most of the time.
Has anyone else encountered this problem after a recent update, or can you give me any advice on how to debug or fix this?
Thanks
I have some pointers from DMESG that someone advised me to run, it is pasted below...
So it seems that I have an issue that is seen before from a search. I haven't found a solution yet and it's also not clear to me yet why it started to occur recently while no change was made in my hardware but I just started searching for the error and I could stumble upon the solution.
However if anyone has a good pointer feel free to help me ;-)
[106559.442845] wlx2cd05a59734b: associated
[106559.506142] wlx2cd05a59734b: Limiting TX power to 30 (30 - 0) dBm as advertised by 3c:84:6a:90:07:b2
[108019.154016] wlx2cd05a59734b: disconnect from AP 3c:84:6a:90:07:b2 for new auth to 3c:84:6a:90:07:c6
[108019.274182] wlx2cd05a59734b: authenticate with 3c:84:6a:90:07:c6
[108019.274222] wlx2cd05a59734b: 80 MHz not supported, disabling VHT
[108019.282464] wlx2cd05a59734b: send auth to 3c:84:6a:90:07:c6 (try 1/3)
[108019.485528] wlx2cd05a59734b: send auth to 3c:84:6a:90:07:c6 (try 2/3)
[108019.487949] wlx2cd05a59734b: authenticated
[108019.489504] wlx2cd05a59734b: associate with 3c:84:6a:90:07:c6 (try 1/3)
[108019.494782] wlx2cd05a59734b: RX ReassocResp from 3c:84:6a:90:07:c6 (capab=0x1431 status=0 aid=2)
[108019.497010] usb 1-1.4: rtl8xxxu_bss_info_changed: HT supported
[108019.500141] wlx2cd05a59734b: associated
[108019.580866] wlx2cd05a59734b: Limiting TX power to 30 (30 - 0) dBm as advertised by 3c:84:6a:90:07:c6
[108022.601033] wlx2cd05a59734b: deauthenticated from 3c:84:6a:90:07:c6 (Reason: 2=PREV_AUTH_NOT_VALID)
[113139.317091] perf: interrupt took too long (7864 > 7848), lowering kernel.perf_event_max_sample_rate to 25250
[126718.134276] audit: type=1400 audit(1677312009.899:269): apparmor="DENIED" operation="capable" class="cap" profile="/usr/sbin/cupsd" pid=27108 comm="cupsd" capability=12 capname="net_admin"
[158703.591538] wlx2cd05a59734b: authenticate with 3c:84:6a:90:07:b2
[158703.606391] wlx2cd05a59734b: send auth to 3c:84:6a:90:07:b2 (try 1/3)
[158703.612001] wlx2cd05a59734b: authenticated
[158703.614917] wlx2cd05a59734b: associate with 3c:84:6a:90:07:b2 (try 1/3)
[158703.629781] wlx2cd05a59734b: RX AssocResp from 3c:84:6a:90:07:b2 (capab=0x1431 status=0 aid=4)
[158703.631633] usb 1-1.4: rtl8xxxu_bss_info_changed: HT supported
[158703.634487] wlx2cd05a59734b: associated
[158703.685622] IPv6: ADDRCONF(NETDEV_CHANGE): wlx2cd05a59734b: link becomes ready
[158703.739770] wlx2cd05a59734b: Limiting TX power to 30 (30 - 0) dBm as advertised by 3c:84:6a:90:07:b2
Ok, I have an update of how I think it is solved in my case, fingers crossed.
First I changed the network setting to avoid power settings to affect my WIFI by changing the content of this file: /etc/NetworkManager/conf.d/default-wifi-powersafe-on.conf
In there is a section which in my case looked like this:
[connection]
wifi.powersave=3
I changed this to:
[connection]
wifi.powersave=2
Where 3 means powersave enabled and 2 means disabled according to what I found in search.
This helped keeping the connection up when the laptop went to sleep, but I still got disconnected from the internet from time to time.
Luckilly, I was at the laptop at one time when it disconnected at which point this command:
sudo journalctl --since="-5 minutes"
gave me a crucial tip:
kernel: wlx2cd05a59734b: Limiting TX power to 30 (30 - 0) dBm as advertised by 3c:84:6a:90:07:c6
kernel: wlx2cd05a59734b: deauthenticated from 3c:84:6a:90:07:c6 (Reason: 2=PREV_AUTH_NOT_VALID)
wpa_supplicant[1162]: wlx2cd05a59734b: CTRL-EVENT-DISCONNECTED bssid=3c:84:6a:90:07:c6 reason=2
wpa_supplicant[1162]: wlx2cd05a59734b: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wpa_supplicant[1162]: wlx2cd05a59734b: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="WIFI" auth_failures=1 duration=10 reason=WRONG_KEY
wpa_supplicant[1162]: BSSID 3c:84:6a:90:07:c6 ignore list count incremented to 2, ignoring for 10 seconds
wpa_supplicant[1162]: wlx2cd05a59734b: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
NetworkManager[1130]: <info> [1677521293.5474] device (wlx2cd05a59734b): supplicant interface state: 4way_handshake -> disconnected
NetworkManager[1130]: <info> [1677521293.5476] device (wlx2cd05a59734b): Activation: (wifi) disconnected during association, asking for new key
Feb 27 10:08:13 christia-Lenovo-IdeaPad-Yoga-13 NetworkManager[1130]: <info> [1677521293.5479] device (wlx2cd05a59734b): state change: activated -> need-auth (reason 'supplicant-disconnect', sys-iface-state: 'managed')
After this I changed my router encryption to WPA3 (and later back to WPA2 as not all my devices support WPA3) to reset the network key and that at least for the last 4 hours seemed to have done the trick.
(I could probably just have selected forget network and re-apply, but telling you exactly what i did just in case it will make a difference)
Hope this helps someone that faces the same issue.