6

When I wake my laptop up after being suspended for a little while, the WiFi signal gets replaced by up and down arrows. The connection still works, but is rather annoying nonetheless. Restarting the Network Manager works, but is only a temporary fix.

I read somewhere that it might be because the connection is getting renamed, thus causing it to think I'm connected via Ethernet instead of WiFi?

How can I fix this?

Edit: I've noticed that this also happens on occasion after turning WiFi on/off.

  • That bug was fixed a while ago: bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1576726 – Android Dev Mar 30 '17 at 1:30
  • @AndroidDev Well, it still happens to me. I skimmed through that, but didn't see any sort of solution. – Mixx Mar 30 '17 at 1:49
  • @M_W: Many fixed bugs happens later to some users like this one. – Xaqron Mar 31 '17 at 23:25
  • My problem started occurring a few weeks ago and it is the reverse of yours. I have Realtek r8169 driver loaded for ethernet (up and down arrows) but after suspend the Intel N-2230 WiFi card gets activated instead. A script to restart it after resuming didn't work so I have to manually call a script to rmmod r8169 and insmod r8169. – WinEunuuchs2Unix Apr 1 '17 at 23:23
  • 1
    I believe you are affected by this unassigned bug I recommend that you subscribe to it so that you can be notified when it's squashed and so that the developers can prioritize their time. I'm sorry I don't have a solution but hopefully this will put you on the right track. – Elder Geek Apr 6 '17 at 0:12
5
+50

Automatic Method

Using sudo powers create the file /lib/systemd/system-sleep/iwlwifi-reset containing:

#!/bin/sh

# NAME: /lib/systemd/system-sleep/iwlwifi-reset
# DESC: Resets Intel WiFi after a long suspend.
# DATE: Apr 1, 2017. Modified April 8, 2017.

# NOTE: Per AU comment restart network.

MYNAME=$0

restart_wifi() {
    /usr/bin/logger $MYNAME 'restart_wifi BEGIN'
#    /sbin/modprobe -v -r iwldvm # This removes iwlwifi too
#    /sbin/modprobe -v iwlwifi   # This starts iwldvm too
    systemctl restart NetworkManager.service
    /usr/bin/logger $MYNAME 'restart_wifi END'
}

/usr/bin/logger $MYNAME 'case=[' ${1}' ]'
case "${1}/${2}" in
    hibernate|suspend|pre*)
      ;;
    resume|thaw|post*)
      restart_wifi;;
esac

Mark the script as executable using:

sudo chmod a+x /lib/systemd/system-sleep/iwlwifi-reset

To check execution of the script after waking up from suspend use:

cat /var/log/syslog | grep iwlwifi

Don't get too excited if it seems to work during testing because there are times when this script works with a short suspend but doesn't work after a long suspend.

If this doesn't work, before trying the Manual Method in the next section, place the command sleep 5 before the line restart_wifi;;.

Manual Method

If the automatic method isn't working using sudo powers create the script /usr/local/bin/iwlwifi-reset containing:

#!/bin/sh

# NAME: /usr/lib/bin/iwlwifi-reset
# DESC: Manually reset Intel WiFi.
# DATE: Apr 1, 2017. Modified April 8, 2017.
# NOTE: Must call using SUDO POWERS.

MYNAME=$0

/usr/bin/logger $MYNAME 'restart_wifi BEGIN'
# modprobe -r iwldvm    # This removes iwlwifi too
# modprobe iwlwifi      # This starts iwldvm too
systemctl restart NetworkManager.service
/usr/bin/logger $MYNAME 'restart_wifi END'

Mark the script as executable using:

sudo chmod a+x /usr/local/bin/iwlwifi-reset

As described in the last section you can check /var/log/syslog for messages when this script is run but you will see any error messages in your terminal anyway.

To call this script use:

sudo iwlwifi-reset

You don't need to specify the directory because /usr/local/bin is in the terminal's command search path.


Edit April 8, 2017 As per OP comment and this How-To, revisions to script were made. Instead of removing and reinserting kernel modules, restarting network services were used.

  • the file creation path & chmod path aren't the same, you'd likely want to fix that in your post.. – doug Apr 2 '17 at 1:15
  • Setting it to just restart the NetworkService appears to be working so far. Using modprobe caused connection issues. – Mixx Apr 8 '17 at 4:18
  • @M_W Thanks for your comment. I've revised the scripts and included a link to various methods of restarting network services from the common to most obscure. – WinEunuuchs2Unix Apr 8 '17 at 10:47
  • Well it's looking like there's no other solution aside from an official bug fix, and although this is a workaround, it appears to be working just fine. +50 – Mixx Apr 8 '17 at 14:02
0

I had this issue also with my HP pavilon G6, which didn't really start until I got a new usb adaptor and plugged it in. After some searching I figured out that the wrong drivers were being used so I installed the correct drivers (Ralink) and it worked out. You didn't mention that you had a second adaptor but maybe checking to see what modprobe returns will help.

I got the idea from the last answer in this thread: Wifi doesn't work after suspend after 16.04 upgrade

  • My WiFi adapter is "Intel Corporation Centrino Wireless-N 2230". It appears to be running the iwlwifi driver: "driver=iwlwifi driverversion=4.8.0-45-generic" Maybe Intel has a specific driver like they do for their graphics... will do some checking. – Mixx Apr 1 '17 at 2:17
  • I found this, but it appears that I already have the same .ucode file located in my /lib/firmware folder. www-ssl.intel.com/content/www/us/en/support/network-and-i-o/… – Mixx Apr 1 '17 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.