This particular version of the "doesn't work after suspend" came after upgrading to 16.04. It seems that the upgrade includes a Wicd applet (added to Metacity Classic Gnome task bar alongside regular network icon), but doesn't seem to work after a suspend. A sudo service network-manager restart duplicates this problem. It takes a complete reboot to get Wifi going again. Any ideas why?

  • 6
    Did you file a bug at launchpad for the problem ??? – apos May 16 '16 at 14:04
  • 3
  • Looks like this problem has been around since Ubuntu 14. – Dan Dascalescu Sep 9 '16 at 3:41
  • This never happened under 14.04 LTS for me. The upgrade to 16.04 LTS is so great I'll keep it, but it keeps forgetting my WiFi password. – SDsolar Jul 11 '17 at 3:32
  • This never happened under 14.04 LTS for me. The upgrade to 16.04 LTS is so great I'll keep it, but it keeps forgetting my WiFi password. The service is clearly running; just that it forgets the password and doesn't connect. I posted this: askubuntu.com/questions/934958/… - and I do not want to deal with blacklisting or anything strange. – SDsolar Jul 11 '17 at 3:57

11 Answers 11

16.04 runs on systemd. Try the following:

sudo systemctl restart network-manager.service

If this works, you can create a script to automate it.

Open a terminal and type the following:

sudo nano /etc/systemd/system/wifi-resume.service Now paste the script in there with a right click. Exit with CTRL + X and press Y to save. Now to activate it: sudo systemctl enable wifi-resume.service

Script:

#/etc/systemd/system/wifi-resume.service
#sudo systemctl enable wifi-resume.service
[Unit]
Description=Restart networkmanager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

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

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

Hope this helps. It works on my laptop.

  • 6
    I would say don't bother reinstalling for this. I did a clean install and I'm running into this issue on 16.04. Never had a problem with 14.04. – Michael Martin-Smucker May 4 '16 at 0:25
  • 3
    Sometimes it works and sometimes not :( – tokam May 17 '16 at 18:52
  • 1
    @mikeymop I have been thinking this as well. I know some parts of the system is still using upstart, so that might trigger something. Since 16.10 is full systemd and does not have the error, you might be correct. – Joakim Koed Sep 2 '16 at 9:19
  • 1
    How can I remove this, this won't work on my system – buzhidao Dec 2 '16 at 5:01
  • 1
    Script is not working for me. "Wifi Disabled" is shown in my networks, I have realtek RTL8723be driver – Arshad Mar 13 '17 at 10:16

Same here with a Lenovo X230. Doesn't happen after every suspend, but sometimes.

sudo systemctl restart network-manager.service 

fixes the issue.

  • 6
    Note: I did a fresh install, no update! – Martin Apr 24 '16 at 13:32
  • 4
    Isn't this answer essentially identical to the top one? – Dan Dascalescu Feb 1 '17 at 4:45

@147pm Did you ever get this working?

I found I had a quite similar problem, though I am on Kubuntu 16.10 (KDE-based, not Gnome), and with an HP ProBook laptop. And, unlike yourself, it wasn't my Wifi which died after suspend/wakeup, but my ethernet port. Still, I wonder if they are related.

I also do see that you do not have the problem under KDE. But I would be interested to know if the solution below does help under Gnome, as the solution is not based upon window manager, desktop environment or applets.

First, just to confirm that restarting the network manager service..

$ sudo systemctl restart network-manager.service

did not work for me.

However, I did find an answer that worked, thanks to buzhidao's question and info at can't connect to internet after suspend and GAD3R's comment there.

Using their info, I found that first researching which ethernet hardware and driver/module I am running, and then removing and re-installing that module, did work for me (though it did not for buzhidao):

Wifi:

$ lspci -knn | grep Net -A2

Ethernet:

$ lspci -knn | grep Ether -A2

The second of these (ethernet) was what i used, and i found:

03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)
        Subsystem: Hewlett-Packard Company RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [103c:1944]
        Kernel driver in use: r8169
        Kernel modules: r8169

so i re-installed the 'r8169' driver:

$ sudo rmmod r8169 && sudo modprobe r8169

and voila! This worked. My ethernet port / connection came back alive (after suspend/wakeup) without having to reboot.

(I also did NOT have a Realtek wifi device, but a Qualcomm Atheros (mod: ath9k) which perhaps explains why wifi continued to work for me after wake-from-suspend.)

As you can see from my comment on that other post, I wondered whether the problem is the common element between Buzhidao and myself: Realtek Semiconductor devices. Even though they use different modules, they might share some common code? Or even be treated differently by the newer kernel code now in some way?

Do you yourself have a Realtek-based wifi device? (using lspci above)? Do you have any luck re-installing the module (rmmod/modprobe above)?

Anyway, just a shot in the dark. If you have found an eventual answer for yourself, please let us know! Thx.

  • 1
    I also have a RTL8111/8168/8411 ethernet and sudo rmmod r8169 && sudo modprobe r8169 solved the problem. – lenooh Jun 24 at 13:25
  • Same issue on Debian 9 with KDE. Reinstalling as above fixed it. Thanks a ton. – sumitkm Aug 2 at 6:16
  • My computer* too has a RTL8111/8168/8411 ethernet device and sudo rmmod r8169 && sudo modprobe r81691 finally fixed the issue for me. Didn't have this problem before kernel version 4.16. (*Debian 10 with GNOME, Kernel 4.16, and proprietary firmware from Realtek) – ossbuntu Aug 8 at 12:54

To auto-restart NetworkManager after resume in an environment without sudo access, create a script in /etc/pm/sleep.d (any name), set the executable bit via chmod +x, and insert the following content:

case "${1}" in
    resume|thaw)
        # systemctl restart network-manager.service
        service NetworkManager restart
;;
esac

For me, the service line worked, but systemctl may work better for you.

Source: https://askubuntu.com/a/92235/30266.

  • 2
    The service NetworkManager restart worked for me, but the placement of the script did not (on 16.04). I had to move the script to /lib/systemd/system-sleep/script-name-here. In this case the first argument to the script is [pre | post], so I had to change the case statement to case "${1}" in ... post) .... I also wrapped the inner statement in case "${2}" in ... suspend) .... – Chester Nov 16 '16 at 13:28
  • 1
    Should be /lib/systemd/system-sleep/ for 15.04+ – qwr Feb 1 '17 at 6:17

For me it seems to be random, but sometimes the wifi just disconnects if I'm connected, or doesn't show networks if I'm not. Sometimes putting my laptop into sleep mode seems to trigger it, but not always.

Some combination of these usually gets it going again without rebooting:

  • sudo iwlist $(ifconfig | grep -Po '^w\w+') scan
  • sudo service network-manager stop; sleep 5; sudo service network-manager start
    • Simply calling restart here never seems to work for me. It looks like it tries to start it up before it's finished shutting it down, hence I have more luck pausing between stop and start.
  • Turn off wifi in UI; wait a few seconds; turn it back on

None of those seems to consistently work, but I listed them in order of most-likely-to-succeed first.

Working method on Ubuntu 16.04:

Create the service: sudo nano /lib/systemd/system/wifi-resume.service

The service is calling the program from:
/etc/init.d/network-manager

Paste the code:

#/lib/systemd/system/wifi-resume.service
#sudo systemctl enable wifi-resume.service
[Unit]
Description=Restart network-manager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target 

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

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

Then enable the service:

sudo systemctl enable /lib/systemd/system/wifi-resume.service

This creates the symlinks into the indicated [Install] directories of /etc/systemd/system and activates the service

Afterwards you can check the status with: systemctl status wifi-resume.service

I had the same problem with bluetooth: After suspend my bluetooth mouse did not work. So I derived the solution from above:

sudo nano /etc/systemd/system/bluetooth-resume.service

enabled the new service

sudo systemctl enable bluetooth-resume.service

and edited the service

#/etc/systemd/system/bluetooth-resume.service
#sudo systemctl enable bluetooth-resume.service
[Unit]
Description=Restart bluethooth at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl restart bluetooth.service

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

I also tried to edit ...

sudo nano /etc/bluetooth/main.conf

and changed

AutoEnable=true

BUT this did NOT work for the "resume problem" and had no inmpact on new bluetooth devices anyhow!

I had the same issue on my laptop Dell Inspiron 15R with Ubuntu 16.04. For me worked the script reported on the second reply.

After having installed the script I tried the suspension with the command in the upper right menu and even closing the lip, solving the problem.

I have to say that the problem was alternating in its behaviour (that is, sometimes it worked before installing the script).

For me the solution was to run

nmcli nm sleep false

in a terminal

I had the same issue connecting back to my home wifi after suspend. Tried the various other suggested answers which would occasionally work but not always.

Eventually the following fix allowed for consistently connecting to the wifi:

1) Edit this file:

sudo vim /etc/NetworkManager/NetworkManager.conf

2) By adding this to it:

[device]
wifi.scan-rand-mac-address=no

Now probably simple

sudo apt update
sudo apt upgrade

should work.

In my case among upgraded packages there was bcmwl-kernel-source (6.30.223.271+bdcom-0ubuntu1~1.3) and after this update wifi works again.

protected by Community May 4 '16 at 14:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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