jonathanio / update-systemd-resolved

Helper script for OpenVPN to directly update the DNS settings of a link through systemd-resolved via DBus.
Other
761 stars 94 forks source link

script fails line 424 systemd-resolve: unrecognized option '--flush-caches' #72

Closed pakair closed 1 year ago

pakair commented 4 years ago

I'm on Linux Mint 18.3

sudo openvpn --config pavlos.ovpn I get ...
systemd-resolve: unrecognized option '--flush-caches'
Edu4rdSHL commented 4 years ago

What systemd version?

pakair commented 4 years ago

On Mint 18.3 systemd --version systemd 229 +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

Edu4rdSHL commented 4 years ago

Current systemd version is 238, you should update your system.

piotr-dobrogost commented 4 years ago

Just revert the change made in https://github.com/jonathanio/update-systemd-resolved/pull/63 and see https://github.com/jonathanio/update-systemd-resolved/issues/62 for more details.

Edu4rdSHL commented 4 years ago

Doesn't make sense a revert because an outdated version of systemd.

Instead we can just evaluate if the --flush-caches is sucess or not and print some warning.

tomeon commented 1 year ago

Fixed in #99.

Edu4rdSHL commented 1 year ago

So far:

edu4rdshl ~ 
❯ busctl call FlushCaches
Too few arguments.

So, we now depend on a specific version of dbus?

tomeon commented 1 year ago

@Edu4rdSHL -- It's not busctl call FlushCaches, it's busctl_call FlushCaches, where busctl_call is this function:

busctl_call() {
  # Preserve busctl's exit status
  busctl call "$DBUS_DEST" "$DBUS_NODE" "${DBUS_DEST}.Manager" "$@" || {
    local -i status=$?
    emerg "'busctl' exited with status $status"
    return $status
  }
}

And DBUS_DEST and DBUS_NODE are defined here:

# Define what needs to be called via DBus
DBUS_DEST="org.freedesktop.resolve1"
DBUS_NODE="/org/freedesktop/resolve1"

So the full busctl command line is:

$ busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager FlushCaches