The reason is quite clear: the physical network is inactive because of the DHCP.
Both elogind and dhcpcd have hooks to handle the problem, but the solution I have found is quite "spaghetti".
dhcpcd is not aware of suspend, so the only way is to use a pre-suspend elogind hook.
On the other side, elogind is not aware of the dhcpcd procedure after resume (lost carrier, rebinding, bla bla), so the only way is a post-binding dhcpcd hook.
The two hooks work, but I find a bit strange to manage two complementary operations with different tools.
Better ideas?
Code: Select all
#!/bin/bash
# -- Stop openvpn before suspend
#
# NOTE: openvpn is stopped here, before suspend, but NOT
# restarted here, because a bounded dhcp address is
# necessary. A dhcp hook is used for that.
# See: /etc/dhcpcd.exit-hook
case $1/$2 in
pre/*)
/usr/bin/logger -p daemon.info "Stopping openvpn.home before suspend."
/etc/init.d/openvpn.home stop
;;
esacCode: Select all
# -- Start openvpn after suspend
#
# NOTE: the runlevel is restored here, but openvpn has been
# stopped with an elogind hook.
# See: /etc/elogind/system-sleep/stop-openvpn-before-suspend
if [ "${interface}" = "eth0" ]; then
if [ "${reason}" = "BOUND" ]; then
/usr/bin/logger -p daemon.info "Restoring runlevel after bound."
/usr/bin/openrc
fi
fiHUjuice

