netbird icon indicating copy to clipboard operation
netbird copied to clipboard

command not found on centos8 (oracle/rocky linux)

Open pomazanbohdan opened this issue 4 years ago • 7 comments

...
Running transaction
  Preparing        :                                                        1/1
  Installing       : wiretrustee-0.2.3-1.x86_64                             1/1
  Running scriptlet: wiretrustee-0.2.3-1.x86_64                             1/1
 Post Install of an clean install
Wiretrustee service has been installed
Wiretrustee service has been started

  Verifying        : wiretrustee-0.2.3-1.x86_64                             1/1

Installed:
  wiretrustee-0.2.3-1.x86_64

Complete!
➜  ~ sudo wiretrustee up --setup-key FB5AD43A-1F8D-4739-BD48-6AF0AE47CBEB
sudo: wiretrustee: command not found

pomazanbohdan avatar Nov 14 '21 20:11 pomazanbohdan

if not sudo

~ wiretrustee up --setup-key FB5AD43A-1F8D-4739-BD48-6AF0AE47CBEB
Failed to write to log, error getting log file info: stat /var/log/wiretrustee/client.log: permission denied
Failed to write to log, error getting log file info: stat /var/log/wiretrustee/client.log: permission denied
Error: mkdir /etc/wiretrustee: permission denied
Usage:
  wiretrustee up [flags]

pomazanbohdan avatar Nov 14 '21 20:11 pomazanbohdan

Hello @pomazanbohdan to help us troubleshoot the issue, could you share the output of the following commands:

get user path

env|grep PATH

get sudo path

sudo env|grep PATH

if the sudo path doesn't have /usr/local/bin in it, could you run the next command?

sudo -E wiretrustee version

This will pass your user's environment variables to the sudo execution.

mlsmaycon avatar Nov 14 '21 20:11 mlsmaycon

Hello @pomazanbohdan to help us troubleshoot the issue, could you share the output of the following commands:

get user path

env|grep PATH

PATH=/home/opc/.local/bin:/home/opc/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

get sudo path

sudo env|grep PATH

PATH=/sbin:/bin:/usr/sbin:/usr/bin

if the sudo path doesn't have /usr/local/bin in it, could you run the next command?

sudo -E wiretrustee version

This will pass your user's environment variables to the sudo execution.

sudo: wiretrustee: command not found

pomazanbohdan avatar Nov 14 '21 20:11 pomazanbohdan

rocky linux 8 sudo env|grep PATH PATH=/sbin:/bin:/usr/sbin:/usr/bin

pomazanbohdan avatar Nov 14 '21 20:11 pomazanbohdan

Ok, thanks for running the checks @pomazanbohdan. I will look into a fix for future releases.

Can you confirm if these are default installations of Centos 8 and Rocky Linux 8? Also, are they both Server(or Minimal) or Desktop(or DVD) editions?

In the meantime, can you test using the full path of the installed command?

sudo /usr/local/bin/wiretrustee up --setup-key KEY

mlsmaycon avatar Nov 14 '21 20:11 mlsmaycon

Can you confirm if these are default installations of Centos 8 and Rocky Linux 8? Also, are they both Server(or Minimal) or Desktop(or DVD) editions?

Yes, these are basic minimal environments on Hetzner (Rocky linux) and Oracle Cloud (OL)

In the meantime, can you test using the full path of the installed command?

sudo /usr/local/bin/wiretrustee up --setup-key KEY

sudo /usr/local/bin/wiretrustee up --setup-key 5F9D9659-A977-417A-82B2-CBB4B9D7DDCA Wiretrustee service has been stopped Wiretrustee service has been started

image

pomazanbohdan avatar Nov 14 '21 20:11 pomazanbohdan

Hi @pomazanbohdan looking closer at the issue, it seems like these systems are using a sudo configuration called secure_path(description below) more restricted than most systems, the defined paths for this setting in Oracle Linux are the ones from your output.

secure_path

Path used for every command run from sudo. If you don't trust the people running sudo to have a sane PATH environment variable you may want to use this. Another use is if you want to have the “root path” be separate from the “user path”. Users in the group specified by the exempt_group option are not affected by secure_path. This option is not set by default.

With that in mind, we are unable to make an effective script that would work transparently without potentially triggering more issues with leftovers or multiple command sources.

An alternative is to use a combination of the which command like the example below or to add the /usr/local/bin in the secure_path definition in the /etc/sudoers file.

Alternative using which:

sudo $(which wiretrustee) version

mlsmaycon avatar Nov 14 '21 22:11 mlsmaycon

Since we are installing the binary in the /bin/ path, this shouldn't be an issue anymore

mlsmaycon avatar Oct 29 '22 12:10 mlsmaycon