I set up an openvpn client on Ubuntu 18.04 by creating a
work.conf file under /etc/openvpn/
I start it with:
sudo systemctl start email@example.com
When I stop it,
sudo systemctl stop firstname.lastname@example.org
it hangs for exactly 90 seconds before finally shutting down. Checking the logs shows the graceful shutdown timing out, at which point a SIGKILL is issued:
journalctl -n 6 -u email@example.com 12:59:51 systemd: Stopping OpenVPN connection to work... 13:01:21 systemd: firstname.lastname@example.org: State 'stop-sigterm' timed out. Killing. 13:01:21 systemd: email@example.com: Killing process 12379 (openvpn) with signal SIGKILL. 13:01:21 systemd: firstname.lastname@example.org: Main process exited, code=killed, status=9/KILL 13:01:21 systemd: email@example.com: Failed with result 'timeout'. 13:01:21 systemd: Stopped OpenVPN connection to work.
I've noticed a bunch of sleeping openvpn processes, some many days old:
ps ax -o command | grep --count '[o]penvpn' 35 ps ax -o stat,start,command | grep '[S]TAT\|[o]penvpn' STAT STARTED COMMAND S Aug 21 /bin/bash /etc/openvpn/update-resolv-conf tun0 1500 1553 ... ... init S Aug 21 run-parts --arg=-a --arg=tun0.openvpn /etc/resolvconf/update.d ...
I see a lot of similar processes in the service's cgroup:
systemd-cgls -u firstname.lastname@example.org | grep --count run-parts 34 systemd-cgls -u email@example.com | grep --count update-resolv-conf 17
I've also noticed that there is an
openvpn.service in addition to my
firstname.lastname@example.org. I'm not clear on the interaction between the two. I think my
@work service is grouped under the other service, but not sure.
I'd like to figure out why the service fails to shutdown cleanly, and how/whether to clean up all those proceses that appear to be duplicates. What would you suggest as a next step?
I can post my conf file if that's useful...