Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVPN client can NOT reconnect if something goes wrong #442

Open
jcea opened this issue Dec 15, 2016 · 7 comments
Open

OpenVPN client can NOT reconnect if something goes wrong #442

jcea opened this issue Dec 15, 2016 · 7 comments
Assignees

Comments

@jcea
Copy link

jcea commented Dec 15, 2016

I have been using OpenVPN as a client for ages. One of the recent clients is a SmartOS native zone instance (base-64 16.3.1). If the VPN connection is severed in anyway (timeout, server restart, etc) the SmartOS client can not connect again.

My OpenVPN is just stock "pkg install". Restarting the SMF service does nothing. After some trying I just restart the zone. Everything is fine after that.

Checking the logfile I see this:

[...]
Wed Dec 14 15:48:31 2016 open_tun: got dynamic interface 'tun0'
Wed Dec 14 15:48:31 2016 Can't set PPA 0: File exists (errno=17)
Wed Dec 14 15:48:31 2016 Exiting due to fatal error
[ Dec 14 15:48:31 Stopping because all processes in service exited. ]

The SMF service will restart the OpenVPN client that cycle of connection & crashing until I restart the zone.

I use the same configuration (ovpn file) in my iOS devices and multiple Linux machines without any issue.

@jperkin jperkin self-assigned this Dec 15, 2016
@jperkin
Copy link
Collaborator

jperkin commented Dec 15, 2016

I'm pretty sure this is caused by TritonDataCenter/smartos-live#626 and is an issue in the tun/tap driver rather than the pkgsrc openvpn package. I'll leave this bug open in the meantime though so we have an extra data point and test candidate when that bug is resolved.

@jcea
Copy link
Author

jcea commented Dec 15, 2016

Any workaround in the meantime? Current situation is quite painful because it requires manual intervention involving a zone reboot.

1 similar comment
@jcea
Copy link
Author

jcea commented Dec 15, 2016

Any workaround in the meantime? Current situation is quite painful because it requires manual intervention involving a zone reboot.

@jclulow
Copy link

jclulow commented Dec 16, 2016

@jcea I make use of the OpenVPN client in a few places. I think I had to add persist-tun to the configuration file to make it work correctly on reconnection.

The full configuration appears below:

client
dev tun
persist-tun
proto udp
resolv-retry infinite
nobind
ca ssl/ca.crt
cert ssl/client.crt
key ssl/client.key
comp-lzo
verb 3
remote-cert-tls server

remote X.X.X.X 1194

@jcea
Copy link
Author

jcea commented Dec 17, 2016

@jclulow I already have "persistent-tun" in my configuration. I think the problem is when the server refused the connection because, for instance, disk full. I have a connection validation script in the server and if something goes wrong with the database, for instance, connections are temporary refused. The problem is that this zone OpenVPN client will die... good, but when the OpenVPN SMF restarts the process, it will fail. This situation persists until the zone is rebooted.

Regular reconnections seems to work ok.

@jperkin This issue is not related to interference between zones, I think. I have more native zones in this machine, but no one else is using TUN at the same time.

I have a trivial way to reproduce this problem:

  1. You have a running OpenVPN client running in a native zone.
  2. You locate the PID of OpenVPN client and just kill it with "kill -9". Use "-9" to be sure the process can not do any cleanup.
  3. Now monitor your SMF OpenVPN log and see the process being created, connecting to the OpenVPN server and dying. Looping forever.

jperkin pushed a commit that referenced this issue Dec 27, 2016
0.15.0	2016-10-09

 BUG FIXES

  * Allow missing trailing LF when reading service name from
    HTTP servers. (Jelmer Vernooij, Andrew Shadura, #442)

  * Fix dulwich.porcelain.pull() on Python3. (Jelmer Vernooij, #451)

  * Properly pull in tags during dulwich.porcelain.clone.
    (Jelmer Vernooij, #408)

 CHANGES

  * Changed license from "GNU General Public License, version 2.0 or later"
    to "Apache License, version 2.0 or later or GNU General Public License,
    version 2.0 or later". (#153)

 IMPROVEMENTS

  * Add ``dulwich.porcelain.ls_tree`` implementation. (Jelmer Vernooij)
jperkin pushed a commit that referenced this issue Feb 1, 2017
Release 0.3.0 of Streamlink!

A lot of updates to each plugin (thank you @beardypig !), automated Windows releases, PEP8 formatting throughout Streamlink are some of the few updates to this release as we near a stable 1.0.0 release.

Main features are:

    Lot's of maintaining / updates to plugins
    General bug and doc fixes
    Major improvements to development (github issue templates, automatically created releases)

Agustín Carrasco <[email protected]> (1):
      Links on crunchy's rss no longer contain the show name in the url (#379)

Brainzyy <[email protected]> (1):
      Add basic tests for stream.me plugin (#391)

Javier Cantero <[email protected]> (2):
      plugins/twitch: use version v3 of the API
      plugins/twitch: use kraken URL

John Smith <[email protected]> (3):
      Added support for bongacams.com streams (#329)
      streamlink_cli.main: close stream_fd on exit (#427)
      streamlink_cli.utils.progress: write new line at finish (#442)

Max Riegler <[email protected]> (1):
      plugins.chaturbate: new regex (#457)

Michiel Sikma <[email protected]> (1):
      Update PLAYER_VERSION, as old one does not return data. Add ability to use streams with /embed/video in the URL, from embedded players. (#311)

Mohamed El Morabity <[email protected]> (6):
      Add support for pluzz.francetv.fr (#343)
      Fix ArteTV plugin (#385)
      Add support for Canal+ TV group channels (#416)
      Update installation instructions for Fedora (#443)
      Add support for Play TV (#439)
      Use token generator for HLS streams, as for HDS ones (#466)

RosadinTV <[email protected]> (1):
      --can-handle-url-no-redirect parameter added (#333)

Stefan Hanreich <[email protected]> (1):
      added chocolatey to the documentation (#380)

bastimeyer <[email protected]> (3):
      Automatically create Github releases
      Set changelog in automated github releases
      Add a github issue template

beardypig <[email protected]> (55):
      plugins.tvcatchup: site layout changed, updated the stream regex to accommodate the change (#338)
      plugins.streamlive: streamlive.to have added some extra protection to their streams which currently prevents us from capturing them (#339)
      cli: add command line option to specific logging path for subprocess errorlog
      plugins.trtspor: added support for trtspor.com (#349)
      plugins.kanal7: fixed page change in kanal7 live stream (#348)
      plugins.picarto: Remove the unreliable rtmp stream (#353)
      packaging: removed the built in backports infavour of including them as dependencies when required (#355)
      Boost the test coverage a bit (#362)
      plugins: all regex string should be raw (#361)
      ci: build and test on Python 3.6 (+3.7 on travis, with allowed failure) (#360)
      packages.flashmedia: fix bug in AMFMessage (#359)
      tests: use mock from unittest when available otherwise fallback to mock (#358)
      stream.hls: try to retry stream segments (#357)
      tests: add codecov config file (#363)
      plugins.picarto: updated plugin to use tech_switch divs to find the stream parameters
      plugins.mitele: support for live streams on mitele.es
      docs: add a note about python-devel needing to be installed in some cases
      docs/release: generate the changelog as rst instead of md
      plugins.adultswim: support https urls
      use iso 8601 date format for the changelog
      plugins.tf1: added plugin to support tf1.fr and lci.fr
      plugins.raiplay: added plugin to support raiplay.it
      plugins.vaughnlive: updated player version and info URL (#383)
      plugins.tv8cat: added support for tv8.cat live stream (#390)
      Fix TF1.fr plugin (#389)
      plugins.stream: fix a default scheme handling for urls
      Add support for some Bulgarian live streams (#392)
      rtmp: fix bug in redirect for rtmp streams
      plugins.sportal: added support for the live stream on sportal.bg
      plugins.bnt: update the user agent string for the http requests
      plugins.ssh101: update to support new site layout
      Optionally use FFMPEG to mux separate video and audio streams (#224)
      Support for 4K videos in YouTube (#225)
      windows-installer: add the version info to the installer file
      include CHANGELOG.rst instead of .md in the egg
      stream.hls: output duplicate streams for HLS when multiple streams of the same quality are available
      stream.ffmpegmux: fix support for avconv, avconv will be used if ffmpeg is not found
      Adultswin VOD support (#406)
      Move streamlink_cli.utils.named_pipe in to streamlink.utils
      plugins.rtve: update plugin to support new streaming method
      stream.hds: omit HDS streams that are protected by DRM
      Adultswin VOD fix for live show replays (#418)
      plugins.rtve: add support for legacy stream URLs
      installer: remove the streamlink bin dir from %PATH% before installing
      plugins.twitch: only check hosted channels when playing a live stream
      docs: tweaks to docs and docs build process
      Fix iframe detection for BTN/cdn.bg streams (#437)
      fix some regex that give deprecation warnings in python 3.6
      plugins.adultswim: correct behaviour for archived streams
      plugins.nineanime: add scheme to grabber api url if not present
      session: add an option to disable Diffie Hellman key exchange
      plugins.srgssr: added support for srg ssr sites: srf, rts and rsi
      plugins.srgssr: fixed bug in api URL and fixed akamai urls with authparams
      cli: try to terminate the player process before killing it (if terminate takes too long)
      plugins.swisstxt: add support for the SRG SSR sites sports sections

fozzy <[email protected]> (1):
      Add plugin for huajiao.com and zhanqi.tv (#334)

sqrt2 <[email protected]> (1):
      Fix swf_url in livestream.com plugin (#428)

stepshal <[email protected]> (1):
      Remove trailing.

stepshal <[email protected]> (2):
      Add blank line after class or function definition (#408)
      PEP8 (#414)
@YanChii
Copy link

YanChii commented Jun 6, 2017

Hi,
I believe problem is this:

Can't unlink interface(ip): Not owner (errno=1)

It can be worked around by manually unplumbing the tap interface after stop.

ifconfig tun0 unplumb

Adding it to /opt/local/lib/svc/method/openvpn (before starting the openvpn) works for me. But if you use multiple tun interfaces, you somehow should find out which tunX interface to unplumb.

Jan

@cron2
Copy link

cron2 commented Sep 11, 2020

There is an open bug on the OpenVPN side for this as well

https://community.openvpn.net/openvpn/ticket/1078

unfortunately I am totally lost what all these PPA and I_PUSH etc. things do on Solaris - on restart (because a server went away and came back) we do try to clean up the existing tun/tap device, and then re-init from scratch.

Unfortunately, something seems to be missing in "cleaning up", so we get these "EEXIST" errors... help from someone who understands Solaris network stuff better is certainly welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants