3

I'm running Ubuntu 14.04 on my HP 15-P234TX laptop. Every time I close the lid or suspend it the wireless stops working until I reboot the whole thing. I can't click on the enable wifi as it says "wifi is disabled by hardware switch". As far as I can tell I don't have a switch anywhere on the case. I've tried running rfkill list all and get the following

rfkill list all

1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes

rfkill unblock all has no effect

__

lspci -knn | grep Net -A2

08:00.0 Network controller [0280]: Intel Corporation Wireless 3160 [8086:08b3] (
rev 83)
Subsystem: Intel Corporation Dual Band Wireless-AC 3160 [8086:0070]
Kernel driver in use: iwlwifi

How do I fix this?

1 Answers1

1

This systemd script which reloads the WiFi kernel module when resuming from suspend. It comes from this answer: Wifi available networks not showing up suddenly:

This script is written for iwlwifi` which is the common Intel driver name. If your's is different change that name below:

#!/bin/sh

# NAME: /lib/systemd/system-sleep/iwlwifi-reset
# DESC: Resets Intel WiFi which can be flakey after a long suspend.
# DATE: Apr 1, 2017. Modified August 30, 2017.

MYNAME=$0

exit

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 'systemctl restart NetworkManager.service (SUPPRESSED)'
    /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

NOTE: Sometimes simply resetting network manager is all that is needed. In that case un-comment the line above by removing #. Then comment out the two lines above it by putting # at the beginning of those two lines.

You'll need to create this script, called iwlwifi-reset, with sudo powers and save it into the directory /lib/systemd/system-sleep. Then mark it executable using:

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