rancher-sandbox / rancher-desktop

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

"Starting virtual machine" step fails due to SSH socket path being too long. #797

Open az82 opened 2 years ago

az82 commented 2 years ago

Rancher Desktop shows the "Starting virtual machine" until timeout.

~/Library/Application\ Support/rancher-desktop/lima/0/ha.stderr.log contains the following lines:

{"level":"debug","msg":"stdout=\"\", stderr=\"unix_listener: path \\\"/Users/od.andreas.zitzelsberger/Library/Application Support/rancher-desktop/lima/0/ssh.sock.Rcl2KoI2X03Sbknt\\\" too long for Unix domain socket\\r\\n\", err=failed to execute script \"ssh\": stdout=\"\", stderr=\"unix_listener: path \\\"/Users/XXXXXXXXXXXXXXXXXXXXXXXX/Library/Application Support/rancher-desktop/lima/0/ssh.sock.Rcl2KoI2X03Sbknt\\\" too long for Unix domain socket\\r\\n\": exit status 255","time":"2021-10-14T15:28:04+02:00"}

with XXXXXXXXXXXXXXXXXXXXXXXX being my user name. Please note that the path /Users/XXXXXXXXXXXXXXXXXXXXXXXX/Library/Application Support/rancher-desktop/lima/0/ssh.sock.Rcl2KoI2X03Sbknt has 109 characters. The path length for Unix Domain Sockets is limited to 108 characters (Linux) or 104 characters (Mac). Unfortunately, my user name is managed and cannot be changed. While the user name is long, I believe it's length is not uncommon.

To Reproduce

Result Rancher Desktop shows the "Starting virtual machine" until timeout.

Expected behaviour Rancher Desktop starts up properly.

Screenshots

grafik

Setup (please complete the following information):

jandubois commented 2 years ago

Once https://github.com/lima-vm/lima/pull/335 is merged, and Lima in RD updated, it will be possible to replace the lima directory with a symlink to a different location with a shorter path.

RD should detect this situation automatically, and create an alternate directory and the symlink, e.g. ~/.rd-lima.

jandubois commented 2 years ago

Once lima-vm/lima#335 is merged, and Lima in RD updated, it will be possible to replace the lima directory with a symlink to a different location with a shorter path.

lima in RD has been updated, so it will be possible to work around this limitation in RD 0.7.0.

RD should detect this situation automatically, and create an alternate directory and the symlink, e.g. ~/.rd-lima.

I want to keep this bug report open because I think this should be handled automatically and not require intervention by the user.

lreimer commented 2 years ago

Just tried with 0.7.0 Release. Unfortunately still not working :(

time="2021-12-17T08:40:51+01:00" level=debug msg="interpreting argument \"/Users/mario-leander.reimer/Library/Application Support/rancher-desktop/lima/_config/0.yaml\" as a file path for instance \"0\""
time="2021-12-17T08:40:51+01:00" level=fatal msg="instance name \"0\" too long: \"/Users/mario-leander.reimer/Library/Application Support/rancher-desktop/lima/0/ssh.sock.1234567890123456\" must be less than UNIX_PATH_MAX=104 characers, but is 104"
2021-12-17T07:40:51.618Z: + limactl --debug start --tty=false /Users/mario-leander.reimer/Library/Application Support/rancher-desktop/lima/_config/0.yaml
2021-12-17T07:40:51.619Z: Error: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl exited with code 1
2021-12-17T07:40:51.619Z: Error starting lima: Error: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl exited with code 1
    at ChildProcess.<anonymous> (/Applications/Rancher Desktop.app/Contents/Resources/app.asar/dist/app/background.js:13:24844)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
jandubois commented 2 years ago

It should be possible to work around it now, even though it is not automatic.

I've just moved the lima home directory to ~/.rdlima:

$ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima
$ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Please try that and let me know if it fixes the issue for you!

Please keep the bug open though, because I think RD should do something like this automatically, but I don't know when we will get around to it.

az82 commented 2 years ago

I can confirm that the work around works for me. Thanks!

lreimer commented 2 years ago

Updated to 0.7.1 to today. Tried the workaround. Unfortunately, it did not work for me. Crashed straight away, the relevant log files are empty.

AndreiChenchik commented 2 years ago

Just as a report:

time="2022-01-16T13:45:04+01:00" level=debug msg="interpreting argument \"/Volumes/External/Users/gumlooter/Library/Application Support/rancher-desktop/lima/_config/0.yaml\" as a file path for instance \"0\""
time="2022-01-16T13:45:04+01:00" level=fatal msg="instance name \"0\" too long: \"/Volumes/External/Users/gumlooter/Library/Application Support/rancher-desktop/lima/0/ssh.sock.1234567890123456\" must be less than UNIX_PATH_MAX=104 characers, but is 110"
2022-01-16T12:45:04.288Z: + limactl --debug start --tty=false /Volumes/External/Users/gumlooter/Library/Application Support/rancher-desktop/lima/_config/0.yaml
2022-01-16T12:45:04.290Z: Error: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl exited with code 1
2022-01-16T12:45:04.290Z: Error starting lima: Error: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl exited with code 1
    at ChildProcess.<anonymous> (/Applications/Rancher Desktop.app/Contents/Resources/app.asar/dist/app/background.js:1:8014)
    at ChildProcess.emit (node:events:394:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)

Had the same issue at 1.0.0-beta.1, workaround from @jandubois fixed that.

Thank you!

giorgiocl commented 2 years ago

I can confirm that I had the same issue that @AndreiChenchik with the 1.0.0-beta.1, but with the solution given by @jandubois all it's working now.!

Thanks !

lreimer commented 2 years ago

I have now also updated and tried the 1.0.0-beta.1 and can also confirm that the described solution / workaround works. Thanks!

starcraft66 commented 2 years ago

Just ran into this and can confirm the symlink solution posted above works!

ChivemarcTechnologies commented 1 year ago

I am having the below issue with my rancher desktop on windows 11. Pls i need assistance to get it fixed

Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:6443

2022-11-02T15:47:42.088Z: Registered distributions: wsl-vpnkit,rancher-desktop-data 2022-11-02T15:47:42.580Z: Registered distributions: wsl-vpnkit 2022-11-02T15:47:43.070Z: Registered distributions: wsl-vpnkit 2022-11-02T15:47:46.632Z: Registered distributions: wsl-vpnkit,rancher-desktop 2022-11-02T15:47:46.807Z: Registered distributions: wsl-vpnkit,rancher-desktop 2022-11-02T15:47:46.807Z: Creating initial data distribution... 2022-11-02T15:47:53.995Z: Did not find a valid mount, mounting /mnt/wsl/rancher-desktop/run/data 2022-11-02T15:47:58.346Z: WSL: executing: cat /root/.docker/config.json: Error: wsl.exe exited with code 1 2022-11-02T15:48:02.490Z: Installing C:\Users\cugwuegb\AppData\Local\Programs\Rancher Desktop\resources\resources\linux\internal\trivy as /mnt/c/Users/cugwuegb/AppData/Local/Programs/Rancher Desktop/resources/resources/linux/internal/trivy into /usr/local/bin/trivy ...

ntindle commented 1 year ago

It should be possible to work around it now, even though it is not automatic.

I've just moved the lima home directory to ~/.rdlima:

$ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima
$ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Please try that and let me know if it fixes the issue for you!

Please keep the bug open though, because I think RD should do something like this automatically, but I don't know when we will get around to it.

This still works as of Feb 7, 2023.

anthonyrea commented 1 year ago

@jandubois's workaround did not work today for version 1.8.1 on MacOS M1.

instance name \\"0\\" too long: "/Users/xxxxxxxxxxxx.xxxxxxxxxxxx/Library/Application Support/rancher-desktop/lima/0/ssh.sock.1234567890123456" must be less than UNIX_PATH_MAX=104 characters, but is 109

Any workarounds for this issue that still work in the newest version?

jandubois commented 1 year ago

@anthonyrea I just heard from somebody last week that it still works. What is the error you are seeing? If you still get the same message as before, then you haven't created the symlink correctly.

anthonyrea commented 1 year ago

Thanks for the response! We executed the two commands above and verified the symlink was created. I'm assuming the process is:

  1. Factory reset
  2. Shut Rancher Desktop down
  3. Create symlink
  4. Launch Rancher Desktop
jandubois commented 1 year ago

I'm assuming the process is:

The Factory reset shouldn't be necessary, but otherwise yes.

It is not clear to me that things are working for you now or not. If they aren't, then we need to see log files of the failure.

uvulpos commented 1 year ago

It should be possible to work around it now, even though it is not automatic.

I've just moved the lima home directory to ~/.rdlima:

$ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima
$ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Please try that and let me know if it fixes the issue for you!

Please keep the bug open though, because I think RD should do something like this automatically, but I don't know when we will get around to it.

I already tried the workaround and also as @anthonyrea described, but it still does not work. And I also reproduced the same issue on another company laptop (both MacOS). Would be glad, if it was possible to have a deeper look and integrate a fix into rancher. But its strage that at the end there is like a 1234567890123456 String. If you could remove that some people would already have access to it

ericpromislow commented 1 year ago

Possible zero-config solution in branch 797-handle-alternative-limapath

jwieder commented 11 months ago

This is still occurring in intel macos w/ rancher dektop v1.9.1.

Before the "fix": nonsense length error caused by inclusion of a 16 character string "1234567890123456". After the "fix": XXX/.rdlima/lima/lima.yaml: no such file or directory

AFAICT no file lima.yaml is created by Rancher Desktop in my local whether I create symlink directories before installing rancher, after installing rancher but before runtime, or after runtime.

downgrading to earlier version 1.6.2 & attempting the same fix from #3716 results in the same error.

Garma00 commented 10 months ago

Hi, Reset kubernetes button inside the Troubleshooting section worked for me (mac m1)

MrR0807 commented 8 months ago

Still occurs on 1.10.0.

arjccpaul commented 6 months ago

It should be possible to work around it now, even though it is not automatic. $ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima $ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Yes it's really a Awesome solution, its worked for me thank you ### @jandubois

reslys commented 3 months ago

I'm still experiencing the same issue on Mac Intel today, this solution worked for me https://github.com/rancher-sandbox/rancher-desktop/issues/797#issuecomment-996510877. Will leave a comment here to see if there are any updates to this issue.

daleksan-s1 commented 1 month ago

The link name (found in the source) is lima-rd, not rdlima

tgruenen commented 1 month ago

I had some trouble with https://github.com/rancher-sandbox/rancher-desktop/issues/797#issuecomment-996510877, so I post here all my steps. I hope this will help you.

Reset Rancher Desktop: "Troubleshooting / Factory Reset", close Rancher Desktop or run the following steps before you start Rancher Desktop!

rm -r ~/.rdlima
rm -r ~/Library/Application\ Support/rancher-desktop
mkdir ~/.rdlima
mkdir ~/Library/Application\ Support/rancher-desktop
ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Restart Rancher Desktop Check Rancher Desktop logs Check some context

kubectl config get-contexts
CURRENT   NAME                                                               CLUSTER                                                            AUTHINFO                                                           NAMESPACE
*         rancher-desktop                                                    rancher-desktop                                                    rancher-desktop                           

kubectl config use-context rancher-desktop

docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT                                      ERROR
default *           Current DOCKER_HOST based configuration   unix:///Users/<username>/.rd/docker.sock

Restart Rancher Desktop

docker context ls
NAME              DESCRIPTION                               DOCKER ENDPOINT                                      ERROR
default *         Current DOCKER_HOST based configuration   unix:///Users/<username>/.rd/docker.sock  
rancher-desktop   Rancher Desktop moby context              unix:///Users/<username>/.rd/docker.sock  
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.

Docker default context can be set by export environment variable DOCKER_HOST=unix:///Users//.rd/docker.sock

reopen shell

So have fun

lagonzalezr commented 4 weeks ago

It should be possible to work around it now, even though it is not automatic.

I've just moved the lima home directory to ~/.rdlima:

$ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima
$ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Please try that and let me know if it fixes the issue for you!

Please keep the bug open though, because I think RD should do something like this automatically, but I don't know when we will get around to it.

this fixed my issue today running on M3 rancher Version 1.14.2, thank you!!

itsmartinhi commented 3 weeks ago

not gonna lie, the fact that this issue still persists is kinda rough.

It should be possible to work around it now, even though it is not automatic.

I've just moved the lima home directory to ~/.rdlima:

$ mv ~/Library/Application\ Support/rancher-desktop/lima ~/.rdlima
$ ln -s ~/.rdlima ~/Library/Application\ Support/rancher-desktop/lima

Please try that and let me know if it fixes the issue for you!

Please keep the bug open though, because I think RD should do something like this automatically, but I don't know when we will get around to it.

But the workaround still works just fine

cassdeckard commented 1 week ago

I want to keep this bug report open because I think this should be handled automatically and not require intervention by the user.

Two and a half years later and users still have to find this thread and then apply the manual fix in order to get Rancher Desktop running on their machine if their username is longer than 21 characters. In my org, everyone's username is firstname.lastname@organization.com so anyone whose name isn't something short like "Li Ngo" is affected by this.

sinewalker commented 1 week ago

Hi, Reset kubernetes button inside the Troubleshooting section worked for me (mac m1)

Following an upgrade to Rancher 1.14.1, I encountered a similar issue. The workaround to move lima did not resolve. Resetting k8s (and deleting the containers) worked. I'm not currently using k8s so this was okay for me, but might be a show-stopper for anyone who does?

My username is 3 characters, so I think that my problem might be different (I was not seeing the error about the Unix path limit).

jandubois commented 1 week ago

Two and a half years later and users still have to find this thread and then apply the manual fix in order to get Rancher Desktop running on their machine if their username is longer than 21 characters.

Unfortunately true. šŸ˜ž The problem is that we have a huge number of open issues, so problems with a simple workaround don't get prioritized.

jandubois commented 1 week ago

I think that my problem might be different

@sinewalker Please create a new issue with sufficient details to investigate rather than commenting on an unrelated issue! Thanks!

eudinnou commented 3 days ago

Unfortunately I also have a long name, and I'm struggling with this issue for 2 days already.

The fix that @jandubois posted works at first, but after I change the k8s resources, I'm getting an error once it tries to restart:

error="failed to execute `ssh -O exit -p 61483 127.0.0.1`,
out=\\"Control socket connect(/Users/[my_very_long_name]/.rdlima/0/ssh.sock): No such file or directory\\\\r\\\\n\\"

Do you maybe have any tips for this one? I would like to avoid changing my name because of this šŸ˜… Thanks!

using: Version 1.14.2 (1.14.2)

eudinnou commented 3 days ago

so apparently the issue for me was because the value of the ram was too high, 64GB, I now allocated 48GB and works šŸ¤Æ