lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.48k stars 1.46k forks source link

terminal does not start (hang) - EACCES permissions problem on binaries directory #7966

Open kjwierenga opened 11 months ago

kjwierenga commented 11 months ago

Describe the bug The terminal in Lens (both local and pod specific) failed to start.

To Reproduce Steps to reproduce the behavior:

  1. Open Lens
  2. Option "Download kubectl binaries matching the Kubernetes cluster version" enabled with default options.
  3. Open local terminal or pod specific terminal

Expected behaviour The terminal opens either locally or in the pod.

Actual behaviour The terminal screen hangs and shows "Connecting..." and a flash message "If terminal shell is not ready please check your shell init files, if applicable.".

Screenshots

Scherm­afbeelding 2023-10-24 om 11 03 11 Scherm­afbeelding 2023-10-24 om 10 54 47

Environment (please complete the following information):

Logs: Running the application executable (/Applications/Lens.app/Contents/MacOS/Lens) or running open Lens from the command line shows the following logging.

error:   ▪ Local kubectl failed to run properly (Error: spawn /Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/kubectl EACCES), unlinking +6s
info:    ▪ Downloading kubectl 1.24.15 from https://storage.googleapis.com/kubernetes-release/release/v1.24.15/bin/darwin/arm64/kubectl to /Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/kubectl +1ms
error:   ┏ [KUBECTL]: failed to download kubectl EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/kubectl' +165ms
error:   ┃ [1] [Error: EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/kubectl']
error:   ┃ [2] {
error:   ┃ [3]   errno: -13,
error:   ┃ [4]   code: 'EACCES',
error:   ┃ [5]   syscall: 'open',
error:   ┃ [6]   path: '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/kubectl'
error:   ┗ [7] }
error:   ┏ Failed to get binary directory EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/.bash_set_path' +7ms
error:   ┃ [1] [Error: EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/.bash_set_path']
error:   ┃ [2] {
error:   ┃ [3]   errno: -13,
error:   ┃ [4]   code: 'EACCES',
error:   ┃ [5]   syscall: 'open',
error:   ┃ [6]   path: '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/.bash_set_path'
error:   ┗ [7] }
error:   ┏ [SHELL-SESSION]: failed to open a local shell Failed to get directory containing kubectl: Error: EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/.bash_set_path' +0ms
error:   ┃ [1] Error: Failed to get directory containing kubectl: Error: EACCES: permission denied, open '/Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15/.bash_set_path'
error:   ┗ [2]     at /Applications/Lens.app/Contents/Resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35190:23

Kubeconfig: Issue not cause by malformed kubeconfig.

Additional context No additional context.

kjwierenga commented 11 months ago

This issue was caused because there was no write permission on the /Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15 directory. I don't know why that happened (maybe that is the actual bug).

Fixed by chmod +w /Users/kjw/Library/Application Support/Lens/binaries/kubectl/1.24.15.

alexwxy commented 11 months ago

same issue: info: [CLUSTER]: refresh {"accessible":true,"disconnected":false,"id":"9e6bc24da882517db87224b43ecce772","name":"kubernetes-admin@cluster.local","online":true,"ready":true} debug: Set kubectl version 1.20.15 for cluster version v1.20.4 using version map error: Failed to get binary directory EACCES: permission denied, open '/Users/alexwang/Library/Application Support/Lens/binaries/kubectl/1.20.15/.bash_set_path' {"code":"EACCES","errno":-13,"path":"/Users/alexwang/Library/Application Support/Lens/binaries/kubectl/1.20.15/.bash_set_path","stack":"Error: EACCES: permission denied, open '/Users/alexwang/Library/Application Support/Lens/binaries/kubectl/1.20.15/.bash_set_path'","syscall":"open"} error: [SHELL-SESSION]: failed to open a local shell Failed to get directory containing kubectl: Error: EACCES: permission denied, open '/Users/alexwang/Library/Application Support/Lens/binaries/kubectl/1.20.15/.bash_set_path' {"stack":"Error: Failed to get directory containing kubectl: Error: EACCES: permission denied, open '/Users/alexwang/Library/Application Support/Lens/binaries/kubectl/1.20.15/.bash_set_path'\n at /Applications/Lens.app/Contents/Resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35190:23"} info: [CLUSTER]: refresh {"accessible":true,"disconnected":false,"id":"9e6bc24da882517db87224b43ecce772","name":"kubernetes-admin@cluster.local","online":true,"ready":true}

torbenaa commented 11 months ago

Same here. Just delete all the folders in /Users/xxx/Library/Application Support/Lens/binaries/kubectl and let Lens download again

thune-xiaobai commented 11 months ago

Same issue. Delete Lens/binaries directory don't help. Seems Lens creates dir with no permissions and have to change it manually.

m-asfari commented 8 months ago

This was off image

philthynz commented 8 months ago

Same issue on Windows 10. Just place the kubectl binary under AppData\Roaming\Lens\binaries\kubectl\bundled and it connects.

straube commented 5 months ago

The option mentioned by @m-asfari was already on for me. However, toggling it off and on again fixed the issue.

wqfra commented 1 month ago

In Windows 10, you can install WSL using PowerShell with the command wsl --install. After completing the installation, you will need to restart your system, and then WSL should be ready for normal use.