2

When I put my desktop in hybernate and then put it back on the wifi is gone. It is simular to the problem described here. But to fix it you have to run a command sudo nmcli nm sleep false. But the nm thing is not working anymore. It has been removed from nmcli (Describe here). So what could you do to fix it?

I am using ubuntu gnome 4.2

2
  • Does your wireless come back withsudo service network-manager restart?
    – chili555
    Mar 20 '16 at 12:59
  • @chili555 yes it does. I could use that but it would be better to get de WiFi out of the sleeping mode instead of restarting al networking
    – Tristan
    Mar 20 '16 at 13:18
4

Please open a terminal and do:

gksudo gedit  /etc/systemd/system/wifi-resume.service

Use nano or kate or leafpad if you don't have the text editor gedit. A new empty file will open. Add the following:

[Unit]
Description=Local system resume actions
After=suspend.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl restart network-manager.service

[Install]
WantedBy=suspend.target

Proofread carefully twice, save and close the text editor.

Now do:

sudo chmod +x  /etc/systemd/system/wifi-resume.service

And next:

sudo systemctl enable wifi-resume.service

I suggest you reboot. Test and let us hear your report.

5
  • Works perfectly. Thanks a lot. It did gave an gtk warning when I did sudo gedit /etc/systemd/system/wifi-resume.service. But I do not now exactly what it was. And after the reboot I could't reproduce it. Is it right to use sudo or is it better to use 'gksudo'
    – Tristan
    Mar 20 '16 at 13:46
  • Probably gksudo, but if it works then it's all good! I will edit the answer for the benefit of the searchers.
    – chili555
    Mar 20 '16 at 15:42
  • @chili555 I have the same problem, I followed your instructions but the last command sudo systemctl enable wifi-resume.service returns 'command not found'
    – bruco
    Apr 7 '17 at 15:47
  • @bruco Please start your own new question and include the results of: lsb_release -a I wonder if your Ubuntu version is older and doesn't use systemd.
    – chili555
    Apr 7 '17 at 20:11
  • @chili555 here is my question: askubuntu.com/questions/903141/…
    – bruco
    Apr 10 '17 at 9:23
1

Another solution similar to the nmcli one Tristan T referenced in the question (without nm, which is no longer an option as Tristan mentioned):

nmcli radio wifi on

I used Owais Lone's answer to a similar question to enable automatic resume of wifi after suspension for my laptop (a Dell Precision) on 16.04 LTS.

I created /etc/pm/sleep.d/10_resume_wifi

#!/bin/sh

case "${1}" in
    resume|thaw)
      nmcli radio wifi off && nmcli radio wifi on;;
esac

followed by a sudo chmod +x /etc/pm/sleep.d/10_resume_wifi to make the file executable.

In case you're wondering about the double semicolons or the solitary close parenthesis like I was, see http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_03.html -- that's just how the case syntax works.

1

For me worked

#!/bin/sh

case $1 in
    resume|thaw)
      nmcli radio wifi off && nmcli radio wifi on;;
esac

followed by a sudo chmod +x /etc/pm/sleep.d/10_resume_wifi

Also user can try if the first fails.

#!/bin/sh

case $1 in
    post|resume|thaw)
      nmcli radio wifi off && nmcli radio wifi on;;
esac 
0

The accepted answer in this thread did not work for me, not did any of the alternate solutions. I had to add the following service file as /etc/systemd/system/wifi-resume.service

[Unit]
Description=Restart Network Manager at resume (after suspend)
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
Type=oneshot
# note: the following also unloads iwlwifi
ExecStart=/usr/sbin/modprobe -r iwldvm
# note: the following also loads iwldvm
ExecStart=/usr/sbin/modprobe iwlwifi
[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

and then enable with sudo systemctl enable wifi-resume.service

As a backup while testing the above, I created a bash script with the following

#!/bin/bash
echo {MY_PASSWORD} | sudo -S modprobe -r iwldvm
echo {MY_PASSWORD} | sudo -S modprobe iwlwifi
echo {MY_PASSWORD} | sudo -S service network-manager restart
notify-send "Wifi: reloaded."
exit

And tied it to a custom keyboard shortcut.

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.