How to fix OpenVPN Options error: --up script fails with '/etc/openvpn/update-systemd-resolved': No such file or directory

Problem

When you start your OpenVPN config, you see the following error message:

Options error: --up script fails with '/etc/openvpn/update-systemd-resolved': No such file or directory (errno=2)
Options error: Please correct this error.
Use --help for more information.

Solution (Linux)

On Linux ou need to install a system package which provides the missing script:

sudo apt -y install openvpn-systemd-resolved

Solution (Windows)

On Windows, this script is not needed and can’t exist.

Comment out the following two lines from your OpenVPN config by prepending #

up /etc/openvpn/update-systemd-resolved
down /etc/openvpn/update-systemd-resolved

This will prevent OpenVPN from trying to run the script.