3

Upgraded from Ubuntu 14.04 to 15.04 on my lenovo T410 a couple of weeks ago and I have been having some problems with my network connection ever since.

Everything worked fine with 14.04, but now I am forced to run 'sudo service network-manager restart' almost every time my computer wakes up. It claims to be connected and it seems to have an IP, but i cant even access my routers GUI. Any permanent solutions out there or anyone with similar problems? It doesnt bother me to run the network-manager restart, except it sucks to do it every time im going to use my computer.

  • It is a known bug. There is a workaround to setup that restart in a script, but did not work for me well either. This happens only with some computers, not all. – Pilot6 May 28 '15 at 08:36
  • 3
    use sudo systemctl restart NetworkManager.service now on 15.04 instead of the old way with upstart. – solsTiCe May 28 '15 at 10:01
  • 1
    @Pilot6, if it is a known bug, do you have a link to the bug tracking where it has been reported? – Denilson Sá Maia Jun 03 '15 at 12:52

2 Answers2

3

You need to mess with systemd service and target.

Create a file nm-resume.service in /etc/systemd/system/suspend.target.wants

with the following content:

[Unit]
Description=Restart NetworkManager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
ExecStart=/bin/systemctl --no-block restart NetworkManager.service

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

This needs to be tweaked or debugged but that's the way to do it.

solsTiCe
  • 9,231
0

You could automate the process by using pm-utils as described here. The script can look like this and needs to be put in /usr/lib/pm-utils/sleep.d. Call it 99zzzMyScript as it will be executed last.

#!/bin/bash

case "$1" in
  hibernate)
    # put commands to run on hibernation here
    ;;
  thaw)
    # put commands to run when returning from hibernation here
    ;;
  suspend)
    # put commands to run on suspend here
    ;;
  resume) 
    # put commands to run when returning from suspension
    ;;
esac
lumen
  • 485
  • Does pm-utils is even used with systemctl now in 15.04 ?? – solsTiCe May 28 '15 at 10:05
  • 1
    According to this http://askubuntu.com/questions/620494/ubuntu-15-04-suspend-doesnt-run-pm-suspend it's not. I can't test it at the moment but perhaps it is worth to try. – lumen May 28 '15 at 10:09