OPNsense Forum

Archive => 19.1 Legacy Series => Topic started by: Mks on February 10, 2019, 09:57:56 pm

Title: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Mks on February 10, 2019, 09:57:56 pm
Hi,

I've an issue with my OpenVPN configuration.
I'm getting the following errors:
Real/virtual IP: unable to contact damon Service nut running?

In the services tab, OpenVPN services are not running (see screenshot).

Log
openvpn[783]: Exiting due to fatal error
openvpn[783]: Cannot open TUN/TAP dev /dev/tun1: Device busy (errno=16)
openvpn[783]: TUN/TAP device ovpns1 exists previously, keep at program end

Nontheless I could establish a connection and everything works fine, strange isn't it?

Any idea, may an issue with the GUI?

OPNsense 19.1-amd64
FreeBSD 11.2-RELEASE-p8-HBSD
OpenSSL 1.0.2q 20 Nov 2018

Thanks
br
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: newsense on February 10, 2019, 11:15:26 pm
Likely unrelated but please make sure you're on the latest version as issues might be already fixed. Should be 19.1.1 now.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: agh1701 on February 10, 2019, 11:57:32 pm
it is pid file corruption.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Mks on February 11, 2019, 05:55:55 am
Hi,

I've updated to the latest version incl. reboot, issue still exists.

openvpn[76270]: Exiting due to fatal error
openvpn[76270]: Cannot open TUN/TAP dev /dev/tun1: Device busy (errno=16)
openvpn[76270]: TUN/TAP device ovpns1 exists previously, keep at program end


Quote
it is pid file corruption.
Thanks, any hints for solving the issue?

I can still establish a VPN connection.

br


br
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Reiter der OPNsense on February 11, 2019, 10:54:10 am
Hi,
after updating to Version 19.1 I have exactly the same issue. Same GUI message, same log entries, but tunnel still works.

OPNsense 19.1.1-amd64
FreeBSD 11.2-RELEASE-p8-HBSD
LibreSSL 2.7.5

Stefan
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: max on February 11, 2019, 12:18:32 pm
Same issue here on: 19.1.1
Code: [Select]
FreeBSD 11.2-RELEASE-p8-HBSD  31af16db12b(stable/19.1)  amd64 1102000

The OpenVPN deamon is running, but the GUI shows the following error in /status_openvpn.php :
Code: [Select]
Common Name Real Address Virtual Address Connected Since
[error] Unable to contact daemon Service not running?

When checking for the PID of my first OpenVPN server I get: 25894
Code: [Select]
# ps awx | egrep "openvpn.*server1\.conf"
25894  -  Ss       0:10.37 /usr/local/sbin/openvpn --config /var/etc/openvpn/server1.conf

When checking, which PID is recorded for my first OpenVPN server I find it to be: 42752
Code: [Select]
# cat /var/run/openvpn_server1.pid
42752

So it seems that the PID doesn't get recorded in the PID file correctly under:
Code: [Select]
/var/run/openvpn_server1.pid

Also, when checking the OpenVPN log file (/var/log/openvpn.log), I see that the OpenVPN daemon exits frequently.
Code: [Select]
Feb 11 11:59:51 openvpn[42752]: Exiting due to fatal error
Feb 11 11:59:51 openvpn[42752]: Cannot open TUN/TAP dev /dev/tun1: Device busy (errno=16)
Feb 11 11:59:51 openvpn[42752]: TUN/TAP device ovpns1 exists previously, keep at program end
...
Feb 11 11:59:51 openvpn[99057]: library versions: LibreSSL 2.7.5, LZO 2.10
Feb 11 11:59:51 openvpn[99057]: OpenVPN 2.4.6 amd64-portbld-freebsd11.2 [SSL (OpenSSL)] [LZO] [LZ4] [MH/RECVDA] [AEAD] built on Jan 28 2019



EDIT:
Removed the counting of openvpn crashes, as it was wrongly counted since last reboot.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: NilsS on February 11, 2019, 12:27:06 pm
Similiar problem over here, after update to 19.1.1 OpenVPN goes up and down multiple times over the day and pulls down all connections, not only the ones over vpn but all WAN traffic.

Two openVPN client connections (not set as default gw - traffic only for selected host with rules)

opnsense: /usr/local/etc/rc.openvpn: OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading endpoints that may use AIRVPN_1_VPNV4.


EDIT:
Feb 11 12:41:09 sense openvpn[3038]: event_wait : Interrupted system call (code=4)
Feb 11 12:41:09 sense openvpn[3038]: SIGTERM received, sending exit notification to peer
Feb 11 12:41:13 sense openvpn[3038]: Closing TUN/TAP interface
Feb 11 12:41:13 sense openvpn[3038]: /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown ovpnc1 1                                                                                                                                         500 1553 10.xx.xx.xxx 255.255.255.0 init
Feb 11 12:41:16 sense openvpn[3038]: SIGTERM[soft,exit-with-notification] received, process exiting

EDIT2:
https://forum.opnsense.org/index.php?topic=11573.msg52453#msg52453 ok this seems to be the problem for me
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: marjohn56 on February 11, 2019, 11:37:47 pm

Issue raised

https://github.com/opnsense/core/issues/3223 (https://github.com/opnsense/core/issues/3223)


Testing a solution.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: marjohn56 on February 11, 2019, 11:39:31 pm
Similiar problem over here, after update to 19.1.1 OpenVPN goes up and down multiple times over the day and pulls down all connections, not only the ones over vpn but all WAN traffic.

Two openVPN client connections (not set as default gw - traffic only for selected host with rules)

opnsense: /usr/local/etc/rc.openvpn: OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading endpoints that may use AIRVPN_1_VPNV4.


EDIT:
Feb 11 12:41:09 sense openvpn[3038]: event_wait : Interrupted system call (code=4)
Feb 11 12:41:09 sense openvpn[3038]: SIGTERM received, sending exit notification to peer
Feb 11 12:41:13 sense openvpn[3038]: Closing TUN/TAP interface
Feb 11 12:41:13 sense openvpn[3038]: /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown ovpnc1 1                                                                                                                                         500 1553 10.xx.xx.xxx 255.255.255.0 init
Feb 11 12:41:16 sense openvpn[3038]: SIGTERM[soft,exit-with-notification] received, process exiting

EDIT2:
https://forum.opnsense.org/index.php?topic=11573.msg52453#msg52453 (https://forum.opnsense.org/index.php?topic=11573.msg52453#msg52453) ok this seems to be the problem for me


This is a different issue, OpenVPN doesn't go down, it just says its not running when it is.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Mks on February 12, 2019, 09:02:11 am

Issue raised
https://github.com/opnsense/core/issues/3223 (https://github.com/opnsense/core/issues/3223)

Thanks, had planned it for today, but you've been faster.

br
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: marjohn56 on February 13, 2019, 01:04:56 pm
Try this patch and let me know what happens, feedback on Github please. https://github.com/opnsense/core/issues/3223 (https://github.com/opnsense/core/issues/3223)


Patch ID: da9fcdb


Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Mks on February 13, 2019, 06:54:42 pm
Hi,

Thanks.

Feedback sent, I got an error after applying the patch.

br
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: kkoh on February 21, 2019, 03:27:06 pm
Just throwing my hat in as well... Same problem.
Title: Re: OpenVPN strange issue (Service not running according to messages, but it works)
Post by: Mks on February 21, 2019, 03:32:48 pm
Hi,

Details are here https://github.com/opnsense/core/issues/3223#issuecomment-465714685 (https://github.com/opnsense/core/issues/3223#issuecomment-465714685)

kr