Hi,
I'm using openvpn-2.2.2-1.el6.x86_64 on Red Hat Enterprise Linux 6.
Executing openvpn twice using the same pid file overwrites the PID in the pid file.
In one console:
# openvpn --deamon --writepid /var/run/openvpn/clustervpn.pid --config clustervpn.conf
# cat /var/run/openvpn/clustervpn.pid
829
Executing second instance without quitting the first (829)
# openvpn --deamon --writepid /var/run/openvpn/clustervpn.pid --config clustervpn.conf
OpenVPN 2.2.2 x86_64-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] built on Aug 10 2012
.... cut ...
Tue Jan 15 21:19:08 2013 [vpnkobra.logic-q.vpn] Peer Connection Initiated with xxx.xxx.xxx.xxx:xxxx
Tue Jan 15 21:19:10 2013 Note: Cannot ioctl TUNSETIFF tun1: Device or resource busy (errno=16)
Tue Jan 15 21:19:10 2013 /sbin/ip link set dev up mtu 1500
Usage: ip link add link DEV [ name ] NAME
[ txqueuelen PACKETS ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
type TYPE [ ARGS ]
ip link delete DEV type TYPE [ ARGS ]
ip link set DEVICE [ { up | down } ]
[ arp { on | off } ]
[ dynamic { on | off } ]
[ multicast { on | off } ]
[ allmulticast { on | off } ]
[ promisc { on | off } ]
[ trailers { on | off } ]
[ txqueuelen PACKETS ]
[ name NEWNAME ]
[ address LLADDR ]
[ broadcast LLADDR ]
[ mtu MTU ]
[ netns PID ]
[ alias NAME ]
[ vf NUM [ mac LLADDR ]
[ vlan VLANID [ qos VLAN-QOS ] ]
[ rate TXRATE ] ]
ip link show [ DEVICE ]
TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | can }
Tue Jan 15 21:19:10 2013 Linux ip link set failed: external program exited with error status: 255
Tue Jan 15 21:19:10 2013 Exiting
Openvpn exits which is good. What isn't good is that openvpn overwrites the PID in /var/run/openvpn/clustervpn.pid
cat /var/run/openvpn/clustervpn.pid
1691
The second process should exit because another is already running in different PID. The PID in the pid file is not checked and therefore it is overwritten - which shouldn't be -. IMHO This defies the reason pid files exists.
Can somebody confirm this behaviour? This is a HA production server and I wonder if a future update will solve this problem?