OpenWrt Forum Archive

Topic: openvpn disconnects with the message "Interrupted system call (code=4)

The content of this topic has been archived on 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I installed OpenWrt (WhiteRussian) on my Linksys WRT54GL and I'm having problems with OpenVPN.
I'm looking for a solution for my problem for very long time and can't find it anywhere.

The problem is that every 24 Hours OpenVPN disconnects and can't reconnect again.
I noticed for the following messages in the log file (I removed line which are the same) :

  Jul 21 21:59:12 (none) kern.err openvpn[905]: event_wait : Interrupted system call (code=4)
  Jul 21 21:59:12 (none) kern.notice openvpn[905]: TCP/UDP: Closing socket
  Jul 21 21:59:12 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:12 (none) kern.info dnsmasq[707]: reading /tmp/resolv.conf.auto
  Jul 21 21:59:12 (none) kern.info dnsmasq[707]: using nameserver X.X.X.X#53 for domain XXXX
  Jul 21 21:59:12 (none) kern.info dnsmasq[707]: using nameserver X.X.X.X#53 for domain XXXX
  Jul 21 21:59:12 (none) kern.info dnsmasq[707]: using local addresses only for domain lan
  Jul 21 21:59:12 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  ...
  Jul 21 21:59:12 (none) kern.notice openvpn[1412]: OpenVPN 2.0.8 mipsel-linux [SSL] [LZO] [EPOLL] built on Jan 30 2007
  Jul 21 21:59:12 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:13 (none) kern.notice openvpn[1412]: Diffie-Hellman initialized with 1024 bit key
  Jul 21 21:59:13 (none) kern.notice openvpn[1412]: TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
  Jul 21 21:59:13 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:13 (none) kern.notice openvpn[1412]: TUN/TAP device tun1 opened
  Jul 21 21:59:13 (none) kern.notice openvpn[1412]: TUN/TAP TX queue length set to 100
  Jul 21 21:59:13 (none) kern.notice openvpn[1412]: /sbin/ifconfig tun1 10.55.1.1 pointopoint 10.55.1.2 mtu 1500
  Jul 21 21:59:14 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:14 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:14 (none) kern.notice openvpn[1412]: /sbin/route add -net X.X.X.X netmask 255.255.255.0 gw 10.55.1.2
  ...
  Jul 21 21:59:14 (none) kern.notice openvpn[905]: /sbin/route del -net X.X.X.X netmask 255.255.255.0
  Jul 21 21:59:14 (none) kern.notice openvpn[905]: Closing TUN/TAP interface
  Jul 21 21:59:14 (none) kern.notice openvpn[905]: SIGTERM[hard,] received, process exiting
  Jul 21 21:59:14 (none) kern.notice openvpn[1412]: /sbin/route add -net X.X.X.X netmask 255.255.255.0 gw 10.55.1.2
  ...
  Jul 21 21:59:15 (none) kern.notice openvpn[1412]: /sbin/route add -net 10.55.1.0 netmask 255.255.255.0 gw 10.55.1.2
  Jul 21 21:59:15 (none) kern.notice openvpn[1412]: Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: Socket Buffers: R=[32767->65534] S=[32767->65534]
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: UDPv4 link local (bound): [undef]:1194
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: UDPv4 link remote: [undef]
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: MULTI: multi_init called, r=256 v=256
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: IFCONFIG POOL: base=10.55.1.4 size=62
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: IFCONFIG POOL LIST
  Jul 21 21:59:15 (none) kern.notice openvpn[1549]: Initialization Sequence Completed

I'm using openwrt and openvpn in order to be able to connect to the office network.
My router is set as the vpn server and we have an openvpn clients pc at the office.

As you can see openvpn disconnects and than tries to initialize the connection again, but it fails although it says :
   "Initialization Sequence Completed"

I'm trying to ping one of the pc that are in my office network and I get an error message : "No route to host"
The only way to resolve this problem is to kill openvpn and to start it again.

So I have some question :
1. Does someone knows what it the meaning of  "Interrupted system call (code=4)" ?
2. I noticed that every hour openvpn closes the connection and starts it again, due to "TLS: tls_process: killed expiring key",
    but at this case there is no problem to connected to the office network.
3. I think that the problem is that when openvpn close the connection due to code=4, it start it again without really "waiting" for
    the 'stop' action to finish, you can see in the above log that there are some 'route add' lines between the 'route del' lines and even
    before the lines :
         Jul 21 21:59:14 (none) kern.notice openvpn[905]: Closing TUN/TAP interface
         Jul 21 21:59:14 (none) kern.notice openvpn[905]: SIGTERM[hard,] received, process exiting
    Does anyone know if there's a way to tell openvpn to wait for a specific amount of time before opening the connection again ?

Thanks,
  Sagi.

If you can find the script where the output is from the "sleep" command is used in linux systems to make scripts wait a certian amount of seconds.
So "sleep 3600" will make it wait 1 hour.  I'm not familiar enough with the openvpn stuff to tell you where to put it though.

hi,
thank you for your answer.
I actually solved this problem by installing Kamikaz on my router instead of WhiteRussian.

thanks,
Sagi.

lol ... That solves a lot of problems it seems.

I have made a workaround by writing script for cron that checks if Openvpn is running or not every 5 mins. If it finds it down it starts it again:

#!/bin/sh
NAME=[o]penvpn
ps | grep $NAME
if [ $? -eq 0 ]; then
   echo "Name Found"
else
   /etc/init.d/S50openvpn
fi

Gr

Khazar

The discussion might have continued from here.