Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paths if you sudo #258

Open
cu8164kp opened this issue Mar 14, 2024 · 2 comments
Open

paths if you sudo #258

cu8164kp opened this issue Mar 14, 2024 · 2 comments

Comments

@cu8164kp
Copy link

sudo on a SLES 15 and I'm assuming other OSs removes some of the PATHs. So when the script looks for k3s and rke2 if you sudo it removes "/usr/local/bin" from the path which causes the script fails. Since we know where k3s and rke2 is going to install by default, I suggest we add /usr/local/bin to the path in the script when checking for k3s/rke2. Then if users uses sudo like in the docs it'll still work.

@mattmattox
Copy link
Contributor

I'm assuming you are asking about the logs-collector script. It is normally recommend to run that script as the root user with sudo.

Can you try this?

curl -Ls rnch.io/rancher2_logs | sudo env "PATH=$PATH" bash

@cu8164kp
Copy link
Author

Sorry, I should have specified the script. https://raw.githubusercontent.com/rancherlabs/support-tools/master/collection/rancher/v2.x/systems-information/systems_summary.sh

SUSE docs (https://www.suse.com/support/kb/doc/?id=000020192) say to run the like script with "| sudo -E bash -s" at the end which causes the PATH error or newer systems. If you don't use sudo it works fine. I know the issue is doc related, but it'd still be nice to have that PATH in there for people trying it that way.

rancher:~/rancher # cat /etc/os-release
NAME="SLES"
VERSION="15-SP5"
VERSION_ID="15.5"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp5"
DOCUMENTATION_URL="https://documentation.suse.com/"

rancher:~/rancher # env | grep PATH
XNLSPATH=/usr/X11R6/lib/X11/nls
MANPATH=/usr/share/man:/usr/local/man
PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin

rancher:~/rancher # sudo env | grep PATH
PATH=/usr/sbin:/usr/bin:/sbin:/bin

rancher:~/rancher # wget -O- https://raw.githubusercontent.com/rancherlabs/support-tools/master/collection/rancher/v2.x/systems-information/systems_summary.sh | sudo -E bash -s
--2024-03-18 14:19:52-- https://raw.githubusercontent.com/rancherlabs/support-tools/master/collection/rancher/v2.x/systems-information/systems_summary.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2772 (2.7K) [text/plain]
Saving to: ‘STDOUT’

  •                                          100%[===================================================================================================>]   2.71K  --.-KB/s    in 0s      
    

2024-03-18 14:19:52 (35.1 MB/s) - written to stdout [2772/2772]

Rancher Systems Summary Report

Run on Mon Mar 18 14:19:52 UTC 2024

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Could not find Rancher 2 container, exiting...

rancher:~/rancher # which k3s
/usr/local/bin/k3s

rancher:~/rancher # kubectl get nodes
NAME STATUS ROLES AGE VERSION
rancher Ready control-plane,master 40d v1.26.8+k3s1

rancher:~/rancher # kubectl get deployments -o wide -n cattle-system
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
rancher 3/3 3 3 40d rancher registry.rancher.com/rancher/rancher:v2.8.2 app=rancher
rancher-webhook 1/1 1 1 40d rancher-webhook registry.rancher.com/rancher/rancher-webhook:v0.4.2 app=rancher-webhook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants