A couple of automated work-arounds follows, depending on which version of the Ubuntu core you are using.
========================================== BEFORE systemd (earlier than Ubuntu 15.04) ==========================================
Create the following executable Bourne shell script in /etc/pm/sleep.d:
MYNAME=`basename`
restart_ethernet() { /usr/bin/logger $MYNAME 'restart_ethernet(r8169) BEGIN' /sbin/modprobe -v -r r8169 /sbin/modprobe -v r8169 /usr/bin/logger $MYNAME 'restart_ethernet(r8169) END' }
/usr/bin/logger $MYNAME 'case=[' ${1} ']' case "${1}" in hibernate|suspend) ;; resume|thaw) restart_ethernet;; esac
===================================== WITH systemd (Ubuntu 15.04 and later) =====================================
1. Create executable Bourne shell script, /usr/local/bin/resume_r8169.sh: MYNAME=`basename` /usr/bin/logger $MYNAME 'restart_ethernet(r8169) BEGIN' modprobe -v -r r8169 modprobe -v r8169 /usr/bin/logger $MYNAME 'restart_ethernet(r8169) END'
2. In /etc/systemd/system, create resume_r8169.service that looks like this: [Unit] Description=Work-around r8169 inability to resume service after suspend After=suspend.target
[Service] User=root Type=oneshot ExecStart=/bin/sh -c /usr/local/bin/resume_r8169.sh TimeoutSec=0 StandardOutput=syslog
[Install] WantedBy=suspend.target
3. sudo systemctl enable /etc/systemd/system/resume_r8169.service
A couple of automated work-arounds follows, depending on which version of the Ubuntu core you are using.
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= =======
BEFORE systemd (earlier than Ubuntu 15.04)
=======
Create the following executable Bourne shell script in /etc/pm/sleep.d:
MYNAME=`basename`
restart_ethernet() { ethernet( r8169) BEGIN' ethernet( r8169) END'
/usr/bin/logger $MYNAME 'restart_
/sbin/modprobe -v -r r8169
/sbin/modprobe -v r8169
/usr/bin/logger $MYNAME 'restart_
}
/usr/bin/logger $MYNAME 'case=[' ${1} ']' suspend) ;;
case "${1}" in
hibernate|
resume|thaw) restart_ethernet;;
esac
======= ======= ======= ======= ======= == ======= ======= ======= ======= ==
WITH systemd (Ubuntu 15.04 and later)
=======
1. Create executable Bourne shell script, /usr/local/ bin/resume_ r8169.sh: ethernet( r8169) BEGIN' ethernet( r8169) END'
MYNAME=`basename`
/usr/bin/logger $MYNAME 'restart_
modprobe -v -r r8169
modprobe -v r8169
/usr/bin/logger $MYNAME 'restart_
2. In /etc/systemd/ system, create resume_ r8169.service that looks like this: Work-around r8169 inability to resume service after suspend target
[Unit]
Description=
After=suspend.
[Service] bin/resume_ r8169.sh syslog
User=root
Type=oneshot
ExecStart=/bin/sh -c /usr/local/
TimeoutSec=0
StandardOutput=
[Install] suspend. target
WantedBy=
3. sudo systemctl enable /etc/systemd/ system/ resume_ r8169.service