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.

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,515
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
  • 505