Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 303875 - net-misc/openvpn:better init script
Summary: net-misc/openvpn:better init script
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Cédric Krier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-07 16:44 UTC by yegle
Modified: 2013-05-03 07:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yegle 2010-02-07 16:44:21 UTC
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)
Comment 1 yegle 2010-02-07 18:28:26 UTC
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;
Comment 2 Peter Volkov (RETIRED) gentoo-dev 2010-02-09 10:12:31 UTC
I have ~10 daemons running in parallel and never noticed anything like this. Anyway assigning on maintainers to review.
Comment 3 yegle 2010-04-24 12:01:58 UTC
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?
Comment 4 Josh Cepek 2013-04-17 20:14:30 UTC
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?
Comment 5 yegle 2013-04-17 20:27:22 UTC
@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.
Comment 6 Dirkjan Ochtman (RETIRED) gentoo-dev 2013-05-03 07:28:39 UTC
Alright, closing.