Wifi Keeps Disconnecting in Ubuntu
Found a solution to a problem that has been plaguing me for months. My wifi would disconnect randomly, unable to recover and requiring a reboot. The solution was not simple to find. Sharing my notes here in case it helps someone else.
The problem seems to be the wireless interface’s Power Management. And the solution was simply to turn it off.
I narrowed the problem down by watching the syslog until the moment it happened:
tail -f /var/log/syslog
In the logs I got messages such as:
upowerd[1147]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2 kernel: [15922.365681] iwlwifi 0000:04:00.0: iwlwifi transaction failed, dumping registers Timeout waiting for hardware access (CSR_GP_CNTRL 0xffffffff) WARNING: CPU: 3 PID: 0 at /build/linux-hL8lyP/linux-4.15.0/drivers/net/wireless/intel/iwlwifi/pcie/trans.c:1973 iwl_trans_pcie_grab_nic_access+0xea/0xf0 [iwlwifi] iwlwifi 0000:04:00.0: Queue 10 is active on fifo 2 and stuck for 10000 ms.
To disable Power Management, first run iwconfig to get your interface name:
iwconfig
You should see something similar:
<pre> wlp4s0 IEEE 802.11 ESSID:"foobar" Mode:Managed Frequency:2.412 GHz Access Point: 84:16:F9:7C:DC:13 Bit Rate=130 Mb/s Tx-Power=22 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on Link Quality=55/70 Signal level=-55 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:2 Invalid misc:5182 Missed beacon:0 </pre>
In my case, mine is wlp4s0. Yours might be wlan0 or something else. As you can see, Power Management: on
To turn it off (replaceing wlp4s0 with value):
sudo iwconfig wlp4s0 power off
This problem haunted me for months! I even waited until Ubuntu 18 was released because I was certain it would resolve itself with a upgrade, but it did not. I was one click away from buying a new motherboard.
Other helpful links:
https://askubuntu.com/questions/857103/random-trouble-with-iwlwifi
One thought on “Wifi Keeps Disconnecting in Ubuntu”
Thanks so much. Mine didn’t even connect at all. Just speed working one day. Your solution was spot on!!