Ubuntu – Keep needing to restart Network Manager for wifi to work

kdenetwork-managernetworkingwireless

Please bear with me as I am not so knowledgeable about networks.

Recently, I have been needing to constantly restart the Network Manager on my laptop with:

sudo service network-manager restart or sudo systemctl restart NetworkManager.service every other minute because my internet would keep dropping.

There is no network connectivity problem with other devices such as my phone and others' laptops so this has to do with my current laptop.

The sheer frequency of having to restart the network manager every minute is very limiting my workflow. I had to restart my Network Manager twice just to post this question. Any help would be grateful.

I am running KDE Plasma 5 and my network card is an Intel Wireless 8265 / 8275.

Best Answer

To fix this, you are going to remove and reinstall your kernel WiFi Device driver

  1. First you need to find your WiFi device driver module name using lshw

    lshw -C network

    you will get a lot more output that this, but the key lines are:

    *-network                 
      description: Wireless interface
     . . . 
     configuration: broadcast=yes driver=iwlwifi driverversion=5.3.0-40-generic firmware=17.3216344376.0 ip=10.127.128.165 latency=0 link=yes multicast=yes wireless=IEEE 802.11
    

    or

     configuration: autonegotiation=on broadcast=yes driver=r8169 firmware=rtl8168g-2_0.0.1 02/06/13 latency=0 
    

    you are looking for the driver name in this case driver=iwlwifi or driver=r8169

  2. Now, using the driver name, do the restart:

    sudo modprobe -r iwlwifi && sudo modprobe iwlwifi
    
  3. Make a shell script to do this for you, because, if you are like me, you will forget these steps, and when you need them it will be when your wireless adapter is not working.

    A. edit a file somewhere in you search path, like ${HOME}/bin/resetWireless adding contents that do this:

    #!/bin/bash
    sudo lshw -C network | grep capabilities | grep driver
    echo if that last command did not say that the driver is iwlwifi then change the next line
    sudo modprobe -r iwlwifi && sudo modprobe iwlwifi
    ## This is from https://askubuntu.com/questions/1169349/keep-needing-to-restart-network-manager-for-wifi-to-work
    

    B. make the file executable with:

    % chmod +x ${HOME}/bin/resetWireless
    

if this works for you, please head over to the place I got it and +up the answer there, because this is a repeat of woulter's answer from How to restart WiFi interface without rebooting (it drops connection)? edited Dec 16 '16 at 8:21 answered Feb 9 '16 at 16:51 Wouter

Related Question