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

Rancher Desktop 1.12.x fails on Windows 10 Pro (22H2, 19045.3930) with MSI error 1603 #6441

Open mape2k opened 9 months ago

mape2k commented 9 months ago

Actual Behavior

Update fails with MSI error code 1603

Steps to Reproduce

Install rancher desktop 1.11.0 with MSI, upgrade rancher desktop 1.12.3 with MSI

Result

MSI Error code 1603

Expected Behavior

Successfull upgrade

Additional Information

Client has no connection to Microsoft Store. WSL2 was installed by MSI and feature install.

Rancher Desktop Version

1.12.3

Rancher Desktop K8s Version

current

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 Pro (22H2, 19045.3930)

What CPU architecture are you using?

x64

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

None

Windows User Only

No response

mape2k commented 9 months ago

Log attached. Seems to be an issue with detecting WSL. msi_rancher.log

Output of wsl --status

Standard Distribution: rancher-desktop-data
Standardversion: 2

Das Windows-Subsystem für Linux wurde zuletzt aktualisiert am 05.02.2024
Der Windows-Subsystem für Linux-Kernel kann mit „wsl --update“ manuell aktualisiert werden. Aufgrund Ihrer Systemeinstellungen können jedoch keine automatischen Updates durchgeführt werden.
Um automatischen Kernel-Updates zu erhalten, aktivieren Sie die Windows Update-Einstellung: „Empfangen von Updates für andere Microsoft-Produkte, wenn Windows aktualisiert wird“.
Weitere Informationen finden Sie unter https://aka.ms/wsl2kernel.

Kernel-Version: 5.10.102.1
mook-as commented 9 months ago

Relevant bits of the log:

time="2024-02-07T09:42:55+01:00" level=info msg="Checking if WSL is installed..."
time="2024-02-07T09:42:55+01:00" level=trace msg="Got 0 appx packages"
time="2024-02-07T09:42:55+01:00" level=trace msg="Failed to get WSL appx package, trying inbox versions..."
time="2024-02-07T09:42:55+01:00" level=trace msg="wsl.exe --status exited" error="invalid write result"
time="2024-02-07T09:42:55+01:00" level=error msg="Failed to get WSL info: invalid write result"

That's errInvalidWrite: https://github.com/golang/go/blob/go1.22.0/src/io/io.go#L31-L32

I think a workaround would be to install WSL from the Microsoft Store (so that the appx version gets picked up), but I should still look into the code a bit to make sure we're not doing something dumb.

Illutax commented 9 months ago

This might be due to the fact, that Windows Defender considers it a trojan virus. image

I tried to install version v1.12.3 via chocolatey.

mape2k commented 9 months ago

This might be due to the fact, that Windows Defender considers it a trojan virus.

We've exception rules for Defender. So our problem is not Defender-related. Your issue is common in Defender with new files which are not widely distributed.

mape2k commented 9 months ago

I think a workaround would be to install WSL from the Microsoft Store (so that the appx version gets picked up), but I should still look into the code a bit to make sure we're not doing something dumb.

Due to technical and compliance restrictions installing from Microsoft Store is not possible. Are there any options to override WSL detect on installation?

gunamata commented 9 months ago

I could not reproduce the issue on my Windows 10. A full scan takes forever on my machine as I have too many files. So, I did a quick scan, a custom scan on my c:/Users/my-username folder and on C:\Program Files\Rancher Desktop . None of these scans found any vulnerabilities on my machine.

jandubois commented 9 months ago

@Illutax I did a full scan on a Windows 11 machine with Rancher Desktop 1.12.3 installed, and Defender did not find anything either.

We also have no other reports of this issue, so possible explanations are:

@Illutax It also seems that you have hijacked this issue from @mape2k; your problem is obviously different. Please create a separate issue if you have more information about how the problem with Defender could be reproduced!

mook-as commented 9 months ago

I think a workaround would be to install WSL from the Microsoft Store (so that the appx version gets picked up), but I should still look into the code a bit to make sure we're not doing something dumb.

Due to technical and compliance restrictions installing from Microsoft Store is not possible. Are there any options to override WSL detect on installation?

You can set the WSLINSTALLED property to skip the check (at which point, of course, you will need to ensure that WSL is installed properly, so I'm not sure you'll get a working Rancher Desktop afterwards):

msiexec /i "Rancher Desktop Setup.msi" WSLINSTALLED=1

You may also want to see if wsl --update is allowed (and possibly wsl --install --web-download --no-distribution).

mape2k commented 9 months ago

You may also want to see if wsl --update is allowed (and possibly wsl --install --web-download --no-distribution).

wsl --update failes due to MS Store restrictions (This is intended.). "--web-download" did not exist as parameter.

Illutax commented 9 months ago

@Illutax It also seems that you have hijacked this issue from @mape2k; your problem is obviously different. Please create a separate issue if you have more information about how the problem with Defender could be reproduced!

I'm sorry, I thought it might be connected. I'll try to gather more information and might open another issue later.

mook-as commented 8 months ago

I think the 1.13.1 installer should have fixed this; does that help? Does it at least produce better logs?

The workaround of setting WSLINSTALLED=1 should still work (by disabling the whole WSL check; but that means you'll need to ensure you have a working WSL independently).

elgcdju commented 8 months ago

Same here when upgrading 1.12.2 to 1.13.1 with WSLINSTALLED=1. Actually I can't even uninstall 1.12.2.

Interesting bits the logs:

MSI (s) (D8:F4) [10:31:38:712]: PROPERTY CHANGE: Adding WSLINSTALLED property. Its value is '1'.
[...]
MSI (s) (D8:F4) [10:31:38:749]: Skipping action: DetectWSL (condition is false)
[...]
Action start 10:31:40: INSTALL.
MSI (s) (D8:CC) [10:31:40:922]: Running ExecuteSequence
MSI (s) (D8:CC) [10:31:40:922]: Doing action: FindRelatedProducts
MSI (s) (D8:CC) [10:31:40:923]: Skipping FindRelatedProducts action: not run in maintenance mode
Action start 10:31:40: FindRelatedProducts.
MSI (s) (D8:CC) [10:31:40:924]: Doing action: AppSearch
Action ended 10:31:40: FindRelatedProducts. Return value 0.
Action start 10:31:40: AppSearch.
MSI (s) (D8:CC) [10:31:40:925]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (D8:CC) [10:31:40:925]: Note: 1: 1402 2: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\358d85cc-bb94-539e-a3cd-9231b877c7a4 3: 2 
MSI (s) (D8:CC) [10:31:40:925]: Doing action: DetectWSL
Action ended 10:31:40: AppSearch. Return value 1.
MSI (s) (D8:6C) [10:31:40:932]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI4D2C.tmp, Entrypoint: IsWSLInstalled
MSI (s) (D8:18) [10:31:40:932]: Generating random cookie.
MSI (s) (D8:18) [10:31:40:934]: Created Custom Action Server with PID 20224 (0x4F00).
MSI (s) (D8:F0) [10:31:40:947]: Running as a service.
MSI (s) (D8:F0) [10:31:40:949]: Hello, I'm your 64bit Impersonated custom action server.
Action start 10:31:40: DetectWSL.
MSI (s) (D8:CC) [10:31:41:056]: Note: 1: 1723 2: DetectWSL 3: IsWSLInstalled 4: C:\WINDOWS\Installer\MSI4D2C.tmp 
CustomAction DetectWSL returned actual error code 1157 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (D8:CC) [10:31:41:056]: Product: Rancher Desktop -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action DetectWSL, entry: IsWSLInstalled, library: C:\WINDOWS\Installer\MSI4D2C.tmp 

Looks like uninstalling the previous version still triggers a DetectWSL which may use a DLL I don't have anymore on my system for some reason, correct?

mook-as commented 8 months ago

@elgcdju — yeah, you appear to have a different issue. It looks like it's trying to uninstall 1.12.2, so it's running IsWSLInstalled (we should make it stop checking on uninstall, but that shouldn't be an issue here), but it's failing somehow. Note that the export has been renamed DetectWSL in 1.13.1 (because it does more things now), but your error message indicates it's using the older name.

That custom action DLL only imports from kernel32 and msvcrt, so I don't expect it to be anything missing there (they're both shipped with Windows 10; checked by doing the upgrade from a Windows 10 machine).

elgcdju commented 8 months ago

So, after having unregistered the two WSL rancher-desktop distributions, manually deleted files and cleaned the registry, I finally succeeded in installing 1.13.1. Thanks!

mape2k commented 5 months ago

You can set the WSLINSTALLED property to skip the check (at which point, of course, you will need to ensure that WSL is installed properly, so I'm not sure you'll get a working Rancher Desktop afterwards):

This works in from 1.12.3 to 1.14.1. Thank you.

mape2k commented 5 months ago

Same here when upgrading 1.12.2 to 1.13.1 with WSLINSTALLED=1. Actually I can't even uninstall 1.12.2.

Can confirm this issue. We're not able to uninstall 1.12.3 or update it to a newer version. We use msiexec /X {MSI-ID...} /quiet WSLINSTALLED=1 now to uninstall old version bevore update. This may not be exactly nice, but it is useful.

@mook-as Should we file a new issue for uninstalling issue?

mook-as commented 5 months ago

Can confirm this issue. We're not able to uninstall 1.12.3 or update it to a newer version. We use msiexec /X {MSI-ID...} /quiet WSLINSTALLED=1 now to uninstall old version bevore update. This may not be exactly nice, but it is useful.

@mook-as Should we file a new issue for uninstalling issue?

@mape2k Yes please, that does seem wrong.

mape2k commented 5 months ago

Connected with #7046