I ran multiple openvpn daemon on my gentoo server. Followed the instruction in ebuild, I linked /etc/init.d/openvpn.test to /etc/init.d/openvpn and uses /etc/openvpn/test.conf as the configure file. I found if I ran both daemon and restart one of them, the other daemon have a very big change to be killed. For example, /etc/openvpn/openvpn restart and you'll find these lines in the openvpn.test daemon's log file: Mon Feb 8 00:19:27 2010 Initialization Sequence Completed Mon Feb 8 00:20:30 2010 event_wait : Interrupted system call (code=4) At this time, if you want to /etc/init.d/openvpn.test restart, you'll got a [!!].Only by removing /var/run/openvpn.test.pid can you restart it. So this issue contains two problems: 1. different daemon's init script shouldn't affect each other? 2. when a daemon exit for some reason, the pid file should be automatically deleted when the corresponding process doesn't exists. Reproducible: Sometimes Steps to Reproduce: 1.install openvpn with two different working server config file(openvpn.conf and test.conf). 2.link /etc/init.d/openvpn.test to /etc/init.d/openvpn 3.start both daemon and restart one of them. Actual Results: the other daemon shouldn't be affected. Expected Results: the other daemon exits. Mon Feb 8 00:19:27 2010 Initialization Sequence Completed Mon Feb 8 00:20:30 2010 event_wait : Interrupted system call (code=4)
Here is my workaround to restart all vpn daemons, in case somebody find this bug report. #!/bin/bash rm /var/run/openvpn* killall -9 openvpn for daemon in /etc/init.d/openvpn*; do $daemon stop; done; for daemon in /etc/init.d/openvpn*; do $daemon start; done;
I have ~10 daemons running in parallel and never noticed anything like this. Anyway assigning on maintainers to review.
root 1661 1 0 17:46 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/4_9841.conf --writepid /var/run/openvpn.4_9841.pid --daemon --setenv SVCNAME openvpn.4_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 1662 1 0 17:46 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/4_9841.conf --writepid /var/run/openvpn.4_9841.pid --daemon --setenv SVCNAME openvpn.4_9841 --cd /etc/openvpn --setenv PEER_DNS yes nobody 1665 1 0 17:46 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/4_9841.conf --writepid /var/run/openvpn.4_9841.pid --daemon --setenv SVCNAME openvpn.4_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 1683 1 0 17:46 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 1684 1 0 17:46 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 3492 1 0 19:47 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 3493 1 0 19:47 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 3574 1 0 19:48 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 3575 1 0 19:48 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 4015 1 0 19:51 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes root 4016 1 0 19:51 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes nobody 4019 1 0 19:51 ? 00:00:00 /usr/sbin/openvpn --config /etc/openvpn/6_9841.conf --writepid /var/run/openvpn.6_9841.pid --daemon --setenv SVCNAME openvpn.6_9841 --cd /etc/openvpn --setenv PEER_DNS yes here's what I got after /etc/init.d/openvpn.6_9841 start /etc/init.d/openvpn.4_9841 start I have user nobody and group nobody in my configure file, so there shouldn't any process running as root user isn't it? And where is the other process come from?
I'm very familiar with Gentoo's openvpn initsscript, and the described behavior in the init does not exist. The $VPNPID variable is used during start-stop-daemon invocations and is correctly set to /var/run/openvpn.pid when called via /etc/init.d/openvpn, and /var/run/openvpn.${SVCNAME#*.}.pid otherwise. The reproduction steps do not exhibit the described behavior, and nor does the logic of the initscript code. Further, the apparent `ps` output suggests that there is more wrong with the OP's setup. Given that this bug is 3 years old and that there's nothing to "do" here, perhaps it can be closed?
@Josh The extra openvpn daemon I mentioned in comment #3 comes from OpenVPN's radiusplugin. I do think this issue can be closed now. This problem has gone long time ago during the upgrade of OpenVPN and/or Gentoo system itself.
Alright, closing.