When you “import” the OVPN into the addon, it creates a copy in /home/osmc/.kodi/userdata/addon_data/script.openvpn.
I suggest re-importing them or changing them in that folder.
You can confirm the exact path of the OVPN being used by using ps.
osmc@osmc-Test:~$ ps -ef |grep openvpn
root 2098 1 3 19:22 ? 00:00:00 /usr/sbin/openvpn --cd /home/osmc/.kodi/userdata/addon_data/script.openvpn --daemon --management 127.0.0.1 1337 --config /home/osmc/.kodi/userdata/addon_data/script.openvpn/blah.ovpn --log /home/osmc/.kodi/userdata/addon_data/script.openvpn/openvpn.log
Thanks for that extra bit of info! I finally had some time this morning to set this up and check that things are working as they were before.
I went into the add-on settings and deleted all my ovpn configs (I had WAY too many) and then reimported the ones I had changed and copied over to vpn-config. The add-on is now working great!! I checked the IP by using my ssh connection and the command “curl ipv4.icanhazip.com” (Thanks @stim) and it seems to be working. One slightly worrying thing is that initially this morning that command gave me my actual home IP and not the VPN one - I had tested it last night and it was working but must have disconnected by this morning. I chose the same ovpn config as last night and it has been showing that one since. I wish there was some indication if the VPN servers connection drops. Another weird thing I noticed is that although under the OSMC/Settings/System Information it shows internet as ‘connected’, when I was checking my DNS settings under My OSMC/Network it says 'Status: eth0 (no internet). But the internet is definitely working and I can stream some video with no problem.
Anyway @gmccauley I want to thank you for all your help and for giving me that extra little bit of information which so ofter makes all the difference!!
If you want to enable automatic restart of openvpn in the event of the process being killed, see here.
Glad I could help!
Such great folks here always willing to help, it’s nice to be able to give back every once in a while.
Thats just the way it is.
No sorry, thats the Bruce Hornsby script.
I’m having similar issues with openvpn. I’m trying to use it independently of the Add-on but it should be doing just the same.
Everything was working fine before the December update but ever since I don’t seem to have an internet connection when the VPN is active.
curl ipinfo.io just times out when the vpn is active.
The log of my openvpn is
sudo openvpn --config US\ EastOrig.ovpn
Sat Jan 27 08:25:34 2018 OpenVPN 2.4.0 arm-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 18 2017
Sat Jan 27 08:25:34 2018 library versions: OpenSSL 1.0.2l 25 May 2017, LZO 2.08
Sat Jan 27 08:25:34 2018 TCP/UDP: Preserving recently used remote address: [AF_INET]22.214.171.124:1198
Sat Jan 27 08:25:34 2018 UDP link local: (not bound)
Sat Jan 27 08:25:34 2018 UDP link remote: [AF_INET]126.96.36.199:1198
Sat Jan 27 08:25:34 2018 WARNING: this configuration may cache passwords in memory – use the auth-nocache option to prevent this
Sat Jan 27 08:25:34 2018 [c0b32b019af33f76bb79148cb20adfb3] Peer Connection Initiated with [AF_INET]188.8.131.52:1198
Sat Jan 27 08:25:35 2018 TUN/TAP device tun0 opened
Sat Jan 27 08:25:35 2018 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Sat Jan 27 08:25:35 2018 /sbin/ip link set dev tun0 up mtu 1500
Sat Jan 27 08:25:35 2018 /sbin/ip addr add dev tun0 local 10.71.10.6 peer 10.71.10.5
Sat Jan 27 08:25:35 2018 Initialization Sequence Completed
Here is the output of the tun0 ifconfig while the vpn is running:
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.71.10.6 netmask 255.255.255.255 destination 10.71.10.5
inet6 fe80::5647:3e2f:a606:9af1 prefixlen 64 scopeid 0x20
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 5 bytes 380 (380.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 148 bytes 13567 (13.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Here are the things I already tried
- tcp rather than udp.
- --management localhost 1337
- --management 127.0.0.1 1337
- installing resolvconf
I’m really confused about what is happening and would appreciate any help.
Thanks for the link. I saw it before but could not get it to work. But it indeed contains the solution. It was indeed the DNS server that was causing issues. I had to install resolvconf and I had to add 184.108.40.206 as a nameserver in the file /etc/resolv.conf. Watch out that it is modified at reboot.
Hi, I have Brian Hornsby openvpn script installed but cannot make it autostart. I try:
sudo mkdir /etc/systemd/system/openvpn@.service.d
sudo nano /etc/systemd/system/openvpn@.service.d/restart.conf
and in the file paste these three lines:
It’s very easy in OSMC - and we do use systemd.
To enable OpenVPN to run at startup, run:
sudo systemctl enable openvpn
To specify which config file to run, you need to:
1 Place the config file in /etc/openvpn and give it a .conf suffix, not .ovpn.
2 Edit file /etc/default/openvpn and add a line
so that it will look for file /etc/openvpn/NL.conf.
Then restart and see if it’s working as you expect.
but nothing work with that script. I also ask on script github but meybe You can help me?
You say it doesn’t work, do you get any errors? Can you run those relevant commands with no issues?
Yes, everything looks OK but when I restart OSMC nothing happen and I must run openvpn from Kodi addons.
I think dilthedog is referring to using systemd without the brian Hornsby addon. So you need to make sure the vpn configuration (comes as a opvn file) exists in:
As a conf file, then open vpn should work on startup.
If not who is your openvpn provider?
Hi, thanks for reply, I have only osmc.conf (I rename my osmc.opvn fille) in
/etc/openvpn/. Now I copy my osmc.ovpn file to that folder but don’t work either.
The file needs to be called:
Whats output of:
I have now two files in
/etc/openvpn/clients: osmc.conf and osmc.ovpn.
Description=OpenVPN connection to %i
ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --config /etc/openvpn/%i.conf --writepid /run/openvpn/%i.pid
ExecReload=/bin/kill -HUP $MAINPID
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_READ_SEARCH CAP_AUDIT_WRITE
# This service is actually a systemd target,
# but we are using a service since targets cannot be reloaded.
I also see this and don’t understand:
osmc@osmc:~$ sudo systemctl enable openvpn
Synchronizing state of openvpn.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable openvpn
osmc@osmc:~$ sudo systemctl status openvpn
● openvpn.service - OpenVPN service
Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2020-03-16 17:58:41 CET; 22min ago
Main PID: 344 (code=exited, status=0/SUCCESS)
mar 16 17:58:41 osmc systemd: Starting OpenVPN service...
mar 16 17:58:41 osmc systemd: Started OpenVPN service.
Sorry /etc/openvpn/client is on buster, please move
sudo systemctl start openvpn@osmc
Then provide the out of:
systemctl status openvpn@vpn
I have that:
osmc@osmc:/etc/openvpn$ sudo systemctl start openvpn@osmc
Job for email@example.com failed because the control process exited with error code.
See "systemctl status firstname.lastname@example.org" and "journalctl -xe" for details.
osmc@osmc:/etc/openvpn$ systemctl status email@example.com
● firstname.lastname@example.org - OpenVPN connection to osmc
Loaded: loaded (/lib/systemd/system/openvpn@.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2020-03-16 20:38:33 CET; 2s ago
Process: 32401 ExecStart=/usr/sbin/openvpn --daemon ovpn-osmc --status /run/openvpn/osmc.status 10 --cd /etc/openvpn --config /etc/openvpn/osmc.conf --writepid /run/openvpn/osmc.pid (code=exited, status=1/FAILURE)
mar 16 20:38:33 osmc systemd: email@example.com: Unit entered failed state.
mar 16 20:38:33 osmc systemd: firstname.lastname@example.org: Failed with result 'exit-code'.
Sorry I forget a couple of steps, been a while since I set this up:
Create the following file:
with the following contents:
Then in osmc.conf change the following line:
sudo systemctl start openvpn@osmc
whats the out of:
systemctl status openvpn@osmc now?
** - These need to be username and password provided by your vpn provider.
OK, it’s working now and autostart is on. I copy that file and do in terminal:
sudo systemctl start email@example.com
sudo systemctl enable firstname.lastname@example.org
osmc@osmc:~$ systemctl status email@example.com
● firstname.lastname@example.org - OpenVPN connection to osmc
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-03-16 21:03:50 CET; 6min ago
Main PID: 329 (openvpn)
└─329 /usr/sbin/openvpn --daemon ovpn-osmc --status /run/openvpn/osmc.status 10 --cd /etc/openvpn --config /etc/openvpn/osmc.conf --writepid /run/openvpn/osmc.pid
mar 16 21:03:57 osmc ovpn-osmc: ROUTE_GATEWAY 192.168.0.1/255.255.255.0 IFACE=eth0 HWADDR=b8:27:eb:c3:4a:53
mar 16 21:04:50 osmc ovpn-osmc: TUN/TAP device tun0 opened
mar 16 21:04:50 osmc ovpn-osmc: TUN/TAP TX queue length set to 100
mar 16 21:04:50 osmc ovpn-osmc: do_ifconfig, tt->did_ifconfig_ipv6_setup=0
mar 16 21:04:50 osmc ovpn-osmc: /sbin/ip link set dev tun0 up mtu 1500
mar 16 21:04:51 osmc ovpn-osmc: /sbin/ip addr add dev tun0 10.8.0.4/24 broadcast 10.8.0.255
mar 16 21:04:51 osmc ovpn-osmc: /sbin/ip route add 220.127.116.11/32 via 192.168.0.1
mar 16 21:04:51 osmc ovpn-osmc: /sbin/ip route add 0.0.0.0/1 via 10.8.0.1
mar 16 21:04:51 osmc ovpn-osmc: /sbin/ip route add 18.104.22.168/1 via 10.8.0.1
mar 16 21:04:51 osmc ovpn-osmc: Initialization Sequence Completed
Thank You very much for help.