Ditching OpenVPN for Wireguard

Raspberry Pi - SurfShark - Wireguard

I have had enough of trying to stop DNS leaks from OpenVPN. It can be installed in Kodi but I prefer it at system level, I am also turned off at losing 70%
of my bandwidth. SSH into OSMC and

Install openresolv wireguard and wiregen by this script:

The installer will ask for your Surfshark email and password and connection type.

That’s it.

OSMC has moved to bullseye one month ago so this is not correct and actually not needed anymore as in bullseye you can just install wireguard from the repository.


Does it pick up SurfSharks DNS servers, if you manually start wire guard.

Please also do as fzinken has requested and remove adding the repositories from your guide, as they are no longer required.

Regards Tom.

Yes it does pick up the DNS servers when started manually. I added the repositories because apt reported it could not find wireguard and it was a clean install with the latest release.

That’s not possible and with that backport you can create conflicts.
Please test again on a clean install and if you can reproduce the issue upload logs.

Wireguard-Confs.zip ends up in a sub-folder called Wireguard-Data - I think you maybe need to cd into that before copying everything into /etc/wireguard…?

Other comments:

  1. Running as root might pose security risks - you might want to see if you can make everything work with sudo at the front of each line instead.

  2. It seems like rather more of this could be put into a .sh file for added automation? If you assume that the user will want to extract all possible .conf files (and there’s no obvious reason not to) could you batch the whole process up into a single script and have the user download that?

  3. I can’t see any good reason to have more than one Wireguard connection running simultaneously; so it ought to be possible to have a command along the lines of wg-quick down which shuts the current connection down without you having to specify which city it was. (I don’t know if this is under your control!)

  4. I suggest you reformat the stuff you need to type as “pre-formatted text” instead of bulleted text

so it looks
like this

and also try and make every piece of text something that can be copied and pasted verbatim (so remove any “or” instructions).

But other than that, this does seem to be working on my Vero 4K+. Nice!


Do you know what part of the config does the dns switch, when running manually?

Also I don’t think resolvconf is recommended on osmc, please check if it works with openresolv instead?

Regards Tom.

Thanks for the suggestions and the thanks. It was my first post so I have a lot to learn.y
I will work on it some more.

1 Like

Yes it works very well with Openresolv


Does openresolv fix dns issues auto start as well?

Thanks Tom.

Unfortunately no Tom, still working on solving.
When you install as a service and then remove it reports an error [file not found]. Obviously not getting installed properly.


So its not just dns that isn’t working on autostart it isn’t connecting to to the wireguard server either?

Are you able to post an example of a service file?

@2cansan Ok think I’ve spotted the problem.

Does /etc/wireguard/Toronto.conf exist?

Thanks Tom.

Tom I don’t have a problem connecting to the server and getting a IP with autostart, just the DNS is not getting picked up. I did a fresh install of Dietpi to experiment with, only installed wireguard and resolvconf and everything worked perfect. The only thing I did differently was enter sudo systemctl enable wg-quick@Toronto and an immediate reboot after.


Are you able to provide an example conf file and service file?

Regards Tom.

I am not sure what a service file is but if you ran wiregen (as root) there would be no need to examine the conf files. As a matter of fate I tared the wireguard dir (as root) and untared it into Dietpi /etc (as root) and no problem, everything worked. What drove me nuts was when someone suggested not to do every step as root and that screwed up the permissions and ownerships and nothing connected.
Hope this helps


I need to see examples of the files requested. Just to clarify I meant a systemd service file.

I need to see these files to understand how Surfshark provides and the DNS servers.

Thanks Tom.

Any distro with Connection Manager is a no go.


This clearly isn’t the case if it works manually. But I can’t help resolve without the requested examples.

Regards Tom.

Sorry I have no idea how to upload text files.