rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
6.02k stars 284 forks source link

False positive diagnosis report that ~/.rd/bin directory has not been added to the PATH #3159

Open himslm01 opened 2 years ago

himslm01 commented 2 years ago

Actual Behavior

As discussed on Slack: https://rancher-users.slack.com/archives/C0200L1N1MM/p1665158849935109

In RD 1.6.0 Diagnostics I'm seeing the error:

The ~/.rd/bin directory has not been added to the PATH, so command-line utilities are not configured in your bash shell.

And yet on my terminal they have been added to the path (3rd in the path list - ignore the duplicates :wink: )...

$ echo $PATH
/home/mdsh/.local/bin:/home/mdsh/bin:/home/mdsh/.rd/bin:/home/mdsh/.local/bin:/home/mdsh/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

and

$ tail -n 4 ~/.bashrc 

### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
export PATH="/home/mdsh/.rd/bin:$PATH"
### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)

The problem, as diagnosed by @jandubois, is that my shall environment does not use a ~/.bash_profile - only a ~/.profile and a ~/.bashrc. This appears to confuse the Diagnosis tool.

When I added a ~/.bash_profile file RD ALSO added the ### MANAGED... section to that and the Diagnoses issue went away.

I do not expect to be forced to change my shell environment in order to make Rancher Desktop happy :-)

Steps to Reproduce

Use RD 1.6.0 on Ubuntu Linux without a ~/.bash_profile

Result

RD 1.6.0 Diagnostics says:

The ~/.rd/bin directory has not been added to the PATH, so command-line utilities are not configured in your bash shell.

Expected Behavior

The above not to happen.

Additional Information

No response

Rancher Desktop Version

1.6.0

Rancher Desktop K8s Version

not important

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Ubuntu

Operating System / Build Version

Ubuntu 22.04

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

deb

Windows User Only

No response

jandubois commented 2 years ago

Yes, the problem is that the diagnostics are checking the PATH via a login shell; something like bash -l -c 'echo $PATH', and the login shell on Linux does not source ~/.bashrc but only ~/.bash_profile.

This needs further research because it is not clear to me if the fix has to go into the PATH management code, or into the diagnostics code.

dmorgan-fa commented 1 year ago

Adding to this, MacOS has been using Zsh as the default shell for a while now. It reports a false positive but still reports that it's:

not configured in your bash shell.

Edit: I realise now there's a diagnosis for both zsh and bash profiles, so if you do things manually and only make it available to zsh, you will see a diagnosis for bash not having Rancher in path.

arturmartins commented 1 year ago

I just installed https://github.com/rancher-sandbox/rancher-desktop/releases/tag/v1.7.0 today and I have the same problem. Brand new mac, no .bashrc nor .bash_profle. I only have a .zshrc file (meaning no .zprofile), and the only entry I have there is

export PATH="~/.rd/bin:${PATH}"

Proof:

~ % which docker
/Users/am/.rd/bin/docker

/cc @jandubois

UPDATE: I found the issue: Rancher Desktop PATH setting was set to Manual. I fixed it by changing it to Automatic.

Screenshot 2023-03-15 at 11 01 07