0

What I am trying to do is:

To play with K0s. So, first I download the K0s scrips and make it executable:

$ curl -sSLf https://get.k0s.sh | sudo sh

.. and here is the terminal output:

> Downloading k0s from URL: 
> https://github.com/k0sproject/k0s/releases/download/v1.20.6+k0s.0/k0s-v1.20.6+k0s.0-amd64
> k0s is now executable in /usr/local/bin`

At this point, when I type k0s in the terminal, I get the help page. Also, when I run type k0s, I get the /usr/local/bin/k0s

Again, when I run $ echo $PATH, I see that /usr/local/bin/ is included in the path variables.

The problem is:

When I try to run:

$ sudo k0s install controller --single

I get:

> sudo: k0s: command not found

But it works when I put the full path of the k0s:

$ sudo /usr/local/bin/k0s install controller --single

I tried this answer and this answer but both did not work. Both suggest changing the mode and erload the shell hash-table.

The question is:

what is the probelm, and how to fix it ?

McLan
  • 2,552
  • 9
  • 51
  • 85
  • 1
    https://unix.stackexchange.com/q/8646/64699 – stark Apr 29 '21 at 12:03
  • sudo man page https://www.sudo.ws/man/1.8.3/sudo.man.html – stark May 01 '21 at 11:50
  • You should make sure `/usr/local/bin` is in your sudo PATH `sudo echo $PATH | grep /usr/local/bin` – NikNye Oct 02 '22 at 23:46
  • @NikNye environment variables will be expanded BEFORE the command gets executed, so this command will just output what your user has set. Instead, use `sudo bash -c 'echo $PATH'` to see what `sudo` sees – mhutter Mar 24 '23 at 09:05

0 Answers0