openvpn-update-resolv-conf icon indicating copy to clipboard operation
openvpn-update-resolv-conf copied to clipboard

Command not recognized

Open chananshgong opened this issue 8 years ago • 14 comments
trafficstars

resolvconf: Error: Command not recognized Usage: resolvconf (-d IFACE|-a IFACE|-u|--enable-updates|--disable-updates|--updates-are-enabled)

yet in the script I see $RESOLVCONF -x -a "${dev}.inet" There is no -x flag above. What's wrong?

chananshgong avatar Jun 04 '17 16:06 chananshgong

Hello,

Can you give more information about our OS, and your RESOLVCONF?

alfredopalhares avatar Jun 12 '17 11:06 alfredopalhares

I am seeing the same problem on Ubuntu 17.04, RESOLVCONF=/usr/sbin/resolvconf .

wgillett avatar Jul 07 '17 20:07 wgillett

I have the same issue on Ubuntu 17.04. Removing -x flag remove the error.

damien-ls avatar Sep 01 '17 06:09 damien-ls

Please set the 'verb' to 4 or above, and then run the openvpn in terminal/console and then post the log to us. Filter out your sensitive information before posting.

lonicerae avatar Sep 01 '17 08:09 lonicerae

I've worked around this problem & am all set thanks

wgillett avatar Sep 04 '17 19:09 wgillett

Removing the -x flag and the ".inet" PROG specifier from the device name fixes the script for me on Ubuntu 16.04.

sheldonh avatar Nov 09 '17 06:11 sheldonh

I will need to fix this and check resolvconf versions.

alfredopalhares avatar Nov 30 '17 11:11 alfredopalhares

Hello!

I'm getting the same error:

resolvconf: Error: Command not recognized
Usage: resolvconf (-d IFACE|-a IFACE|-u|--enable-updates|--disable-updates|--updates-are-enabled)
$ cat /etc/issue
Ubuntu 16.04.4 LTS
$ uname -a
Linux intrepid 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I can confirm that fix by sheldonh is working:

Removing the -x flag and the ".inet" PROG specifier from the device name fixes the script for me on Ubuntu 16.04.

slavafomin avatar Apr 16 '18 06:04 slavafomin

Same fix by @sheldonh for Ubuntu 18.04

4.15.0-64-generic #73-Ubuntu SMP Thu Sep 12 13:16:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

M-Devloo avatar Sep 24 '19 22:09 M-Devloo

I need to add some OS detection to this.

alfredopalhares avatar Sep 25 '19 08:09 alfredopalhares

Would it be reliable to just check if the command output is Command not recognised and try the other command in that case?

The current command should work in systemd's resolvectl and openresolv, so it's just the resolvconf that ships with Ubuntu <18.04(?) that doesn't support those command line options.

This is the output of resolvconf --version for each command. Perhaps this output could be used for detecting which command to run if not the method above. (sorry I cannot copy&paste text into Firefox atm)

openresolv on Arch Linux: 20190925_19h51m09s

resolvectl on Arch Linux (symlinked to /usr/bin/resolvconf when being used): 20190925_19h48m25s

resolvconf on Ubuntu 16.04: 20190925_19h48m49s

ammgws avatar Sep 25 '19 10:09 ammgws

The best way would be to verify that OS that the script is running on. Basically all the debian based images (Raspbian, Ubuntu, Debian) ships with a resolvconf that does not know this -x command.

The accepted answer on stackoverflow can give some insight: https://unix.stackexchange.com/questions/6345/how-can-i-get-distribution-name-and-version-number-in-a-simple-shell-script

When testing this on a a Ubuntu 18.04 server, echo ${OS} returns: Ubuntu On Raspbian, echo ${OS} returns Raspbian GNU/Linux

With this, you can specify certain commands depending on a certain distro. If you want to really go nuts, you can also check the version with ${VER}

M-Devloo avatar Sep 25 '19 22:09 M-Devloo

Wouldn't the most surefire way be to detect the "version" of resolveconf being run, because the user may be using a different one as to what was originally shipped. For example on one of my Ubuntu 16.04 I'm running openresolv instead of the script originally shipped with the distro.

ammgws avatar Sep 25 '19 22:09 ammgws

My solution for Ubuntu 16.04 was to apt install the openresolv package which upgrades the default resolvconf to a newer version that supports the -x option.

Edit: Which of course is mentioned in the README. :sweat_smile:

tudorpavel avatar Mar 25 '20 10:03 tudorpavel