I have been searching through the forums for a general solution to this problem for 18.04 (such as this one or this one).

The first example was originally posted for 14.04 and tells me to add a script to the /etc/pm/sleep.d. I tried two different scripts:

case "$1" in
sudo nmcli nm sleep false
sudo pkill -f wpa_supplicant
exit $?



case "${1}" in
    nmcli r wifi off && nmcli r wifi on ;;

but neither of them worked. I'm not proficient enough in Linux to understand exactly what the scripts are doing but I do get that this should run when resuming from suspend (I did make it executable using sudo chmod +x). In fact just running

nmcli nm sleep false

in a terminal gave me "Error: argument 'nm' not understood"

An answer on this post says that sleep.d is no longer active as of 16.04 and that the script should be put in /lib/systemd/systemd-sleep.

The second post seems to be specific to Lenovo laptops as it says to run:

sudo tee /etc/modprobe.d/blacklist-ideapad.conf <<< "blacklist ideapad_laptop"

but I have an HP Pavilion with an Intel Corporation Wireless 3160[8086:08b3] rev (83), as per lspci | grep Network, and there is no "blacklist-ideapad.conf" file in /etc/modprobe.d

There is no hard switch on my laptop for the Wifi adapter so I was hoping someone could help me tweak these answers for my situation. How would I add a similar script to the systemd-sleep since its not a folder or script (that I can read anyway)?

EDIT Based on @nobody's solution here is what my iwlwifi.conf file looks like:

# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system.  When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211

options iwlwifi remove_when_gone=1

Perhaps I didn't add the "options iwlwifi..." line properly?

Thanks for the help! Jeremy


When I'm right the module iwlwifi is for your wlan.

Please create the file /etc/modprobe.d/iwlwifi.conf with content

options iwlwifi remove_when_gone=1

Remove dev from PCIe bus if it is deemed inaccessible

Since then I had no Problem anymore with connection after wakeup from suspend to ram or suspend to disk.

More Option for the module modinfo iwlwifi | fgrep parm

  • Thanks for your response @nobody. I don't really understand the part about "removing dev from PCIe bus if it is deemed inaccessible". I don't even know how I would know if it were inaccessible, let alone where to begin to remove a dev. Also, to create the file would I use sudo touch /etc/modprobe.d/iwlwifi.conf – JJGabe Sep 16 '19 at 14:35
  • I read the modinfo iwlwifi and understand the "Remove dev..." comment. However, this did not work for me. I have edited my original answer to include the contents of my iwlwifi.conf file – JJGabe Sep 23 '19 at 17:25

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.