Fix Ubuntu Wifi On but unable to connect

Ubuntu 17.04 and 17.10 have an issue on some computers that can’t handle MAC address randomization while Wifi scanning. Wifi MAC randomization is a good thing, but not totally debugged yet on Ubuntu.

Workarounds to fix Ubuntu 17.04/17.10 Wifi dropouts

The telltale sign of this problem is seen by

dmesg -w

as messages like

mwifiex_pcie 0000:01:00.0: wlan0: already connected
ieee80211 phy0: mwifiex_cfg80211_sched_scan_start : Invalid Sched_scan parameters

I tried each of the workarounds below. Sometimes, Wifi still drops. In those cases, I Bluetooth tether to my phone (phone on Wifi), which seems completely stable.

Disable NetworkManager MAC randomization

Note: Ubuntu 17.10 may have this already set.

  1. add to /etc/NetworkManager/NetworkManager.conf
    [device]
    wifi.scan-rand-mac-address=no
    
  2. restart NetworkManager
    sudo service network-manager restart
    

Disable Wifi power management

  1. edit /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
    wifi.powersave = 2 
    
  2. reboot

Wifi module reset

The above techniques work for SOME but NOT ALL Microsoft Surface Pro 3 for Wifi on Ubuntu 17.04/17.10. A stronger method that does work with periodic resets is to remove/reinsert the Wifi kernel module and restart Network Manager.

  1. create a script ~/wifi_reset.sh
    #!/bin/sh
    
    modprobe -r mwifiex_pcie
    modprobe mwifiex_pcie
    
    service network-manager restart
    
  2. make the script executable
    chmod +x ~/wifi_reset.sh
    
  3. Every time your Wifi disconnects due to the dmesg -w messages noted above, use
    ~/wifi_reset.sh
    

Bluetooth tether

When all else fails, I Bluetooth tether to my Wifi-connected smartphone. Yes this is limited to 1.6 Mbps upload/download. It’s just a backup method.

Notes

Please see the comments below for other methods that have helped e.g. for iwlwifi Intel WiFi adapters.

reference

Tags:

Categories:

Updated:

Leave a Comment