update-systemd-resolved icon indicating copy to clipboard operation
update-systemd-resolved copied to clipboard

Error running OVPN: Linux ip addr add failed: external program exited with error status: 2

Open typoworx-de opened this issue 4 years ago • 3 comments

I added this as mentioned in instructions at end of my ovpn file after running make command.

script-security 2
up /etc/openvpn/scripts/update-systemd-resolved
up-restart
down /etc/openvpn/scripts/update-systemd-resolved
down-pre

Trying to connect openvpn I'm getting this error:

Linux ip addr add failed: external program exited with error status: 2

typoworx-de avatar Mar 17 '20 16:03 typoworx-de

Trying to figure out the issue I thought systemd-resolve --flush-caches could be the culprit on my Ubuntu 16.4 LTS linux (which doesn't know --flush-caches on systemd-resolve).

This may be a good addon to your script. I don't have nscd installed... this may need to be added as well.

flushdns() {
  systemd-resolve --flush-caches > /dev/null;

  test -x $(which dnsmasq) && {
    info "Restarting service dnsmasq";
    systemctl restart dnsmasq;
  }

  test -x $(/etc/init.d/dns-clean) && {
    info "Running /etc/init.d/dns-clean";
    /etc/init.d/dns-clean;
  }
}

indeed I was not able to fix my problem at all ... the script still breaks with Linux ip addr add failed: external program exited with error status: 2

typoworx-de avatar Mar 17 '20 16:03 typoworx-de

Is this script able to work with custom-tun/tap names? My tun device is named "tun-xyz"?

typoworx-de avatar Mar 17 '20 16:03 typoworx-de

I'll have to take a look at the --flush-caches issue. It may be that it cannot be supported on that version of Ubuntu, and given it won't be supported for that much longer, not worth the additional work.

As to the tun/tap names - I use custom names with mine and it works fine. The name is passed into the script by OpenVPN.

jonathanio avatar May 13 '20 09:05 jonathanio

The cache-flushing issue should be solved by #99.

Not sure what to make of

Linux ip addr add failed: external program exited with error status: 2

Though I don't think it's coming directly from update-systemd-resolved, as that script does not call ip addr add.

@typoworx-de -- is this still an issue for you? Can you please try testing out the latest revision in the master branch?

tomeon avatar Jul 22 '23 14:07 tomeon

Linux ip addr add failed: external program exited with error status: 2

This come directly from openvpn. The OpenVPN config file is specifically configured to use external program ip, rather than a built-in method, which is non-standard, user configured.

A basic description of this can be found here.

TinCanTech avatar Jul 22 '23 14:07 TinCanTech