rancher-sandbox / rancher-desktop

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

Error Starting Kubernetes on Windows #2135

Open cronventis opened 2 years ago

cronventis commented 2 years ago

Actual Behavior

After installing 1.3.0 I tried starting kubernetes, but it fails.

Steps to Reproduce

Result

Error Starting Kubernetes

Error: C:\Users\xxx\AppData\Local\Programs\Rancher Desktop\resources\resources\win32\bin\kubectl.exe exited with code 1

Last command run: C:\Users\xxx\AppData\Local\Programs\Rancher Desktop\resources\resources\win32\bin\kubectl.exe config current-context

Context: Waiting for services

 stdout: ''
}
2022-04-29T07:45:55.262Z: WSL: executing: readlink -f $HOME/.docker/cli-plugins/docker-compose: Error: wsl.exe exited with code 1
2022-04-29T07:45:55.262Z: Failed to readlink/rm $HOME/.docker/cli-plugins/docker-compose Error: wsl.exe exited with code 1
    at ChildProcess.<anonymous> (C:\Users\xxx\AppData\Local\Programs\Rancher Desktop\resources\app.asar\dist\app\background.js:17:141690)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
  stdout: ''
}

Expected Behavior

Kubernetes Starts

Additional Information

No response

Rancher Desktop Version

1.3.0

Rancher Desktop K8s Version

1.19.16

Which container runtime are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 21H2 (Build 19044.1645)

What CPU architecture are you using?

x64

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

No response

Windows User Only

cronventis commented 2 years ago

With containerd:

2022-04-29T07:53:53.928Z: /sbin/init exited gracefully.
2022-04-29T07:53:54.029Z: Registered distributions: rancher-desktop
2022-04-29T07:53:54.231Z: Registered distributions: Ubuntu,k0s-ctl,k0s-2,rancher-desktop-data,rancher-desktop,k0s-1,k0s-3
2022-04-29T07:53:54.554Z: Registered distributions: Ubuntu,k0s-ctl,k0s-2,rancher-desktop-data,rancher-desktop,k0s-1,k0s-3
2022-04-29T07:53:54.668Z: Registered distributions: Ubuntu,k0s-ctl,k0s-2,rancher-desktop-data,rancher-desktop,k0s-1,k0s-3
2022-04-29T07:53:54.668Z: data distro already registered
2022-04-29T07:53:56.895Z: Stopping background process host-resolver vsock host.
2022-04-29T07:54:18.204Z: Installing C:\Users\xxx\AppData\Local\Programs\Rancher Desktop\resources\resources\linux\internal\trivy as /mnt/c/Users/c.romeni/AppData/Local/Programs/Rancher Desktop/resources/resources/linux/internal/trivy into /usr/local/bin/trivy ...
2022-04-29T07:55:28.036Z: Waited more than 60 secs for nerdctl images to succeed. Giving up.
cronventis commented 2 years ago

Trying around and found another log:

2022-04-29T08:26:46.258Z: Stopping background process host-resolver vsock host.
2022-04-29T08:26:46.855Z: Unmounting missing device /dev/sdc: 119 118 8:32 / /mnt/wsl/rancher-desktop/run/data rw,relatime shared:2 - ext4 /dev/sdc rw,discard,errors=remount-ro,data=ordered
2022-04-29T08:26:47.006Z: Did not find a valid mount, mounting /mnt/wsl/rancher-desktop/run/data
2022-04-29T08:27:06.854Z: Installing C:\Users\xxx\AppData\Local\Programs\Rancher Desktop\resources\resources\linux\internal\trivy as /mnt/c/Users/xxx/AppData/Local/Programs/Rancher Desktop/resources/resources/linux/internal/trivy into /usr/local/bin/trivy ...
2022-04-29T08:28:17.276Z: Waited more than 60 secs for nerdctl images to succeed. Giving up.
cronventis commented 2 years ago

@jandubois Since you moved it from Next to Later... Right now I'm completely unable to use Rancher Desktop already für months.. First because of the Certificate issue, now because of this... Can you give me a hint what the issue is so maybe I can fix my setup to make it work? Or is it completely up to you to fix it? And if it is on your side only, am I the only one who has this issue? Why is it moved to "Later", while it actually makes Rancher Desktop unusable for everyone who encounters this issue..

jandubois commented 2 years ago

Can you give me a hint what the issue is so maybe I can fix my setup to make it work?

I can't tell from the log snippets what the real issue is. It looks like it is related to file system mounts, so maybe a WSL2 configuration problem? Given that things work fine for most users, I suspect it will be something you could fix yourself, but we first need to understand why it is failing.

It would help to get the full set of logs and not just the last couple of lines. Could you zip them up and attach here?

am I the only one who has this issue?

Hard to tell, there may be one or maybe 2 other issues that may be related, but it isn't clear. The vast majority of the users do not have this problem, and it did not come up in our manual testing either.

Why is it moved to "Later", while it actually makes Rancher Desktop unusable for everyone who encounters this issue..

The 1.4.0 release is essentially done; only high-severity fixes will still make it in, and problems found during manual QA.

If we wait until there are no open issues left, then there won't be another release ever again... If we had lots of reports of this particular breakage, then it would be considered a blocker, but anything affecting only a few users, especially if the cause of the problem is still unknown, cannot stop the release.

I'm sorry this is not working for you, and I hope you can provide additional information that will help us to track this down.

cronventis commented 2 years ago

k3s.log wsl.log

Here are the two log-files that where created when starting rancher desktop (which results in the error). If I can help with anything else, let me know.

Ah.. I started rancher-desktop as admin to see what happens.. And It started... And is running.. But should I always "Run as Administrator" when starting rancher Desktop?

jandubois commented 2 years ago

Ah.. I started rancher-desktop as admin to see what happens.. And It started... And is running.. But should I always "Run as Administrator" when starting rancher Desktop?

No, you should never run RD as root, as it can create various problems. I've filed #1560 to add a check that would disallow this; alas it has not been implemented yet.

I would recommend trying to run once more as admin and do a Factory Reset, and then try running it normally again.

I think on Windows RD will restart automatically after a Factory Reset, so you need to stop it as early as possible to avoid it creating files and directories again.

jandubois commented 2 years ago

I'm going to close this issue, but please add details if the Factory Reset doesn't allow you to recover normal operation.

cronventis commented 2 years ago

Well, resetting in Windows "Run as Admin" did not change anything, still the same error... So this issue should still be open... Right? Or did you find a solution?

jandubois commented 2 years ago

I'm going to re-open this issue, but don't have any suggestion how to recover RD from running it as admin before. We will need #2186 implemented, so you can run once as admin, perform "Factory Reset" to remove all items owned by the admin account, and then start the app again as a regular user. This will hopefully be implemented in the 1.5.0 release.

Right now Rancher Desktop will restart automatically after a Factory Reset, so all files/directories will be recreated by the admin user again.

Furthermore we have #1560 that should prevent a user from getting into the situation in the first place.