New to the VPN world and hoping for a little/lot of help


Hi im hoping I can get a bit of help to save me from tearing my hair out

I have recently purchased a VPN (SurfShark) and want to get it set up to run on my raspberry pi 3b running a fresh install of OSMC
I followed their generic instructions for setting up OpenVPN and am able to use putty to access command line and get the service up and running I think. (instructions below)

Install the necessary packages by entering the command:

sudo apt-get install openvpn unzip

If you are requested to enter your password, please enter your computer’s admin password.

Navigate to OpenVPN directory by entering:

cd /etc/openvpn

Download Surfshark OpenVPN configuration files:

sudo wget


sudo unzip configurations

Remove the .zip file which will not be used:

sudo rm configurations

To see the list of all the available servers enter:


Choose one of the servers from the server list and connect to Surfshark by entering:

sudo openvpn [file name]

OpenVPN will ask you for service credentials.

You have successfully connected to Surfshark if in the Terminal logs you can see “Initialization Sequence Completed”.

To disconnect from the OpenVPN connection simply open terminal and press Ctrl + C.

My first query is once I start the service I see the message “Initialization Sequence Completed”.
but I no longer have a command line to test if its working is this how it should be? if I did this through the terminal directly on osmc could I get osmc to start up again?

Secondly as far as I can tell it disconnects as soon as I disconnect the putty session
is there a way I can make it auto start when the pi starts up?

I have read various articles but have seen a lot of conflicting information and I think things may have changed in how its done so I am confused. Any help at all would be greatly appreciated.



Use the Brian Hornsby add-on.


Thanks for the reply

So I have downloaded and installed the Brian Hornsby add-on

I have picked and named my .ovpn file

When I try to run I am not asked for username and password I just get the below error message

An error has occurred whilst trying to connect OpenVPN
Unable to connect to OpenVPN management interface

I’m sure this is something simple I just cant work it out


This is probably why the connection is failing.

You need to edit the relevant .ovpn file and change the line auth-user-pass to auth-user-pass userpass. Then in /etc/openvpn (using sudo) create a file userpass and add two lines:


substituting your own username and password. (I’ve called the file userpass but you can use anything you want.) Change permission on the file so it’s only readable by root:

sudo chmod 600 /etc/openvpn/userpass

and you should be good to go.


unfortunately already tried that :frowning: still didn’t work

I followed the guide from here and can now start a service and get it to start when I reboot.

Problem is there is no internet connection when I do I am getting “curl: (6) Could not resolve host:”

There was a suggestion at the bottom of here that it could be a dns problem so I fixed that with the dns from my provider but still same issue.

I’m sorry to be a pain but I have been at this since Thursday and have got no further and I would really like to understand it as I eventually want to set up my pi zero-w and pi 4 with the same thing

if I sudo service OpenVPN stop and then run curl I get my actual ip and location etc


Do you want to use Brian Hornsby’s add-on, which allows control though the Kodi interface, or do you simply want OpenVPN to run automatically at startup?

If you want an evidence-based analysis, rather than just a wild guess, we need logs.

Please see


either method would be good whatever is easiest tbh

logs are at



Jul 07 21:25:00 osmc-Mortimer ovpn-client[323]: RESOLVE: Cannot resolve host address: (Name or service not known)

This is happening because at this point in the startup sequence, there is still no network. You should enable “Wait for Network” in My OSMC > Network anf reboot.


ok I have tried that but still get the same could not resolve host error :frowning:

I really do appreciate you taking a look tho :slight_smile:


You need to provide new logs.


Looking at the log a bit further, it eventually connects successfully and you get

Jul 07 21:25:13 osmc-Mortimer ovpn-client[323]: Initialization Sequence Completed

Then 34 minutes later OpenVPN is stopped:

Jul 07 21:59:31 osmc-Mortimer sudo[1626]:     osmc : TTY=pts/0 ; PWD=/home/osmc ; USER=root ; COMMAND=/usr/sbin/service openvpn stop

New Logs


I manually stop the OpenVPN as there is no internet connection


This is also connecting successfully.

This line

Jul 07 22:16:10 osmc-Mortimer ovpn-client[298]: PUSH: Received control message: 'PUSH_REPLY,dhcp-option DNS,dhcp-option DNS,redirect-gateway def1,sndbuf 524288,rcvbuf 524288,explicit-exit-notify,block-outside-dns,route-gateway,topology subnet,ping 60,ping-restart 180,ifconfig,peer-id 0,cipher AES-256-GCM'

contains the directive block-outside-dns as well as dhcp-option DNS,dhcp-option DNS

If you can ping, I’m guessing that this is blocking your DNS somehow. Unfortunately, I’m out of time for today. If @Tom_Doyle is still around, perhaps he can help with the installation/configuration of resolvconf or openresolv – or it’ll have to wait until tomorrow.


happy to wait :slight_smile: I got work in the morning and its getting late here



From what I can tell from looking at the config files, this is being pushed by the server; unfortunately it looks this option is Windows specific. A possible work around is to use openresolv as @dillthedog suggested. Please try:

sudo apt-get install openresolv

and the the following to the bottom of your chosen .opvn file (Or .conf file if you created on of these):

script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf  

Hopefully dns will work now and you should be able to access the internet using surfsharks’s dns servers.

Thanks Tom.


ok so I tried to ping and it works no packet loss

I installed openresolve and updated the bottom of my conf file with the script rebooted pi and still get the error curl 6 could not resolve host

log here



I can see from the logs that openvpn is running /etc/openvpn/update-resolv-conf, as expected.

With openvpn not running please issue:

cat /etc/resolv.conf | paste-log

Then with openvpn running, same again:

cat /etc/resolv.conf | paste-log

Please post the links provided.

Thanks Tom.


not running


Unable to upload log. Please check your internet connection.



Sorry forgot no dns, with vpn running; issue:

cat /etc/resolv.conf

and then manually copy & paste the contents here?

Thanks Tom.