rancher-sandbox / rancher-desktop

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

WSL encounters error on Rancher Desktop launch #3355

Open adamkpickering opened 2 years ago

adamkpickering commented 2 years ago

Discussed in https://github.com/rancher-sandbox/rancher-desktop/discussions/3320

Originally posted by **himani-dangwal** November 1, 2022 I am using Rancher Desktop since past few months and 3 days back it suddenly started throwing wsl error . 2022-11-02T05:53:44.801Z: WSL failed to execute wsl.exe --unregister rancher-desktop-data: Error: wsl.exe exited with code 4294967295 2022-11-02T05:53:44.801Z: Error setting up data distribution: Error: wsl.exe exited with code 4294967295 at ChildProcess. (C:\Users\XXX\AppData\Local\Programs\Rancher Desktop\resources\app.asar\dist\app\background.js:1:7750) at ChildProcess.emit (node:events:390:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) { code: 4294967295, command: [ 'wsl.exe', '--unregister', 'rancher-desktop-data' ] } 2022-11-02T05:53:44.873Z: WSL: executing: /bin/sh -c [ -e /etc/os-release ] && . /etc/os-release ; echo ${VERSION_ID:-0.1}: Error: wsl.exe exited with code 4294967295

Note that the user who is experiencing this issue has posted logs in the discussion linked above.

arunrajput23 commented 2 years ago

@adamkpickering solution for above error?

nicolasbouchard-ubi commented 2 years ago

I experience this exact issue too with version 1.6.2. This is the error that is printed in the Rancher Desktop error window:

2022-11-15T20:25:12.227Z: WSL failed to execute wsl.exe --unregister rancher-desktop-data: Error: wsl.exe exited with code 4294967295 2022-11-15T20:25:12.227Z: Error setting up data distribution: Error: wsl.exe exited with code 4294967295 at ChildProcess. (C:\Users\redacted\AppData\Local\Programs\Rancher Desktop\resources\app.asar\dist\app\background.js:1:7750) at ChildProcess.emit (node:events:390:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) { code: 4294967295, command: [ 'wsl.exe', '--unregister', 'rancher-desktop-data' ] } 2022-11-15T20:25:12.232Z: Capturing output: wsl.exe --distribution rancher-desktop --exec /bin/sh -c [ -e /etc/os-release ] && . /etc/os-release ; echo ${VERSION_ID:-0.1}

After digging for while, I noticed something strange in the Event Viewer that makes me think it's a permission issue. Each time I have the error I have these logs too: image

I wondered how tar.exe could be implicated in this, and found this in wsl logs:

2022-11-17T20:13:33.749Z: Creating initial data distribution... 2022-11-17T20:13:33.749Z: Running: wsl.exe --distribution rancher-desktop --exec /bin/busybox mkdir -p /etc/rancher 2022-11-17T20:13:33.752Z: Running: wsl.exe --distribution rancher-desktop --exec /bin/busybox mkdir -p /var/lib 2022-11-17T20:13:36.902Z: Running: wsl.exe --distribution rancher-desktop --exec busybox [ -e /bin/busybox ] 2022-11-17T20:13:36.905Z: Running: wsl.exe --distribution rancher-desktop --exec busybox [ -e /bin/mount ] 2022-11-17T20:13:36.908Z: Running: wsl.exe --distribution rancher-desktop --exec busybox [ -e /bin/sh ] 2022-11-17T20:13:36.912Z: Running: wsl.exe --distribution rancher-desktop --exec busybox [ -e /lib ] 2022-11-17T20:13:36.915Z: Running: wsl.exe --distribution rancher-desktop --exec busybox [ -e /etc/passwd ] 2022-11-17T20:13:37.020Z: Capturing output: wsl.exe --distribution rancher-desktop --exec wslpath -a -u C:\Users\SVC_AC~1\AppData\Local\Temp\rd-distro-vtr9ds\distro.tar 2022-11-17T20:13:37.092Z: Running: wsl.exe --distribution rancher-desktop --exec tar -cf /mnt/c/Users/SVC_AC~1/AppData/Local/Temp/rd-distro-vtr9ds/distro.tar -C / /bin/busybox /bin/mount /bin/sh /lib /etc/passwd /etc/rancher /var/lib 2022-11-17T20:13:37.465Z: Error registering data distribution: Error: tar.exe exited with code 2 2022-11-17T20:13:37.465Z: Running: wsl.exe --unregister rancher-desktop-data 2022-11-17T20:13:37.495Z: WSL failed to execute wsl.exe --unregister rancher-desktop-data: Error: wsl.exe exited with code 4294967295 2022-11-17T20:13:37.495Z: Error setting up data distribution: Error: wsl.exe exited with code 4294967295 at ChildProcess. (C:\Users\svc_acf_buildsystem\AppData\Local\Programs\Rancher Desktop\resources\app.asar\dist\app\background.js:1:7750) at ChildProcess.emit (node:events:390:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) { code: 4294967295, command: [ 'wsl.exe', '--unregister', 'rancher-desktop-data' ] } 2022-11-17T20:13:37.499Z: Capturing output: wsl.exe --distribution rancher-desktop --exec /bin/sh -c [ -e /etc/os-release ] && . /etc/os-release ; echo ${VERSION_ID:-0.1}

Any workaround suggestion? Tried installing preceding versions with no success.

adamkpickering commented 2 years ago

@arunrajput23 @nicolasbouchard-ubi I'm not aware of any workarounds at the moment. The dev team is quite busy, and will get to this when we have time. In the meantime, please let us know if you figure anything out!

craigtmoore commented 7 months ago

I was able to work around this problem. I just got a new laptop and I needed to install Rancher Desktop. I encountered the same problem that @nicolasbouchard-ubi had:

Error registering data distribution: Error: tar.exe exited with code 2

Note: I thought it might be a problem because I was using the cygwin version of tar, so I installed the GunWin32.Tar executable and put that first on my path. However, after diving into the problem further, I don't think it was necessary to install that version of tar.

I think the problem is that the installer failed to create the directory where it was going to create the distro.tar file. So in @nicolasbouchard-ubi example you see the following from his log file

 wsl.exe --distribution rancher-desktop --exec wslpath -a -u C:\Users\SVC_AC1\AppData\Local\Temp\rd-distro-vtr9ds\distro.tar
2022-11-17T20:13:37.092Z: Running: wsl.exe --distribution rancher-desktop --exec tar -cf /mnt/c/Users/SVC_AC1/AppData/Local/Temp/rd-distro-vtr9ds/distro.tar -C / /bin/busybox /bin/mount /bin/sh /lib /etc/passwd /etc/rancher /var/lib
2022-11-17T20:13:37.465Z: Error registering data distribution: Error: tar.exe exited with code 2

It was basically failing to create the C:\Users\SVC_AC1\AppData\Local\Temp\rd-distro-vtr9ds directory in the Temp folder. So I went ahead and created the rd-distro-vtr9ds directory then executed the wsl command that failed

wsl.exe --distribution rancher-desktop --exec tar -cf /mnt/c/Users/SVC_AC1/AppData/Local/Temp/rd-distro-vtr9ds/distro.tar -C / /bin/busybox /bin/mount /bin/sh /lib /etc/passwd /etc/rancher /var/lib

That should create the distro.tar file in the rd-distro-vtr9ds directory and then you can import the distribution into WSL using the following command

wsl --import rancher-desktop-data .\ distro.tar

Once that happened, I restarted my computer (just in case) and then was able to launch Rancher Desktop successfully. I hope this helps someone.