Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect WSL MSI installation via CMD and Psexec #11432

Closed
1 of 2 tasks
soragXYZ opened this issue Apr 6, 2024 · 12 comments
Closed
1 of 2 tasks

Incorrect WSL MSI installation via CMD and Psexec #11432

soragXYZ opened this issue Apr 6, 2024 · 12 comments

Comments

@soragXYZ
Copy link

soragXYZ commented Apr 6, 2024

Windows Version

Microsoft Windows [version 10.0.22631.3296]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Irrelevant

Distro Version

Irrelevant

Other Software

No response

Repro Steps

  • Become admin
  • Start CMD as admin
  • Start powershell with Psexec:
Psexec -e -s -i powershell.exe
  • In the 2nd window, execute install.cmd which installs the MSI

Here are the install scripts:
File install.cmd

@call powershell .\installMsiWSL2.ps1

File installMsiWSL.ps1

#Requires -RunAsAdministrator

# Variables
$MsiFile = "wsl.2.1.5.0.x64.msi"
$MsiLogFile = "C:\theLogDirectory"

$RC = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/I $MsiFile /L*vx ${MsiLogFile} /qn" -Wait -PassThru).ExitCode

if (-not ($RC -eq 0 -or $RC -eq 3010)) {
    Write-Output "The msi has returned an error: ${RC}"
    Exit 1
}

Expected Behavior

MSI should be installed correctly
The command wsl --version should display the installed version

Actual Behavior

The MSI is not installed: the command wsl --version returns the help instead of the currently installed version

I have to launch the .cmd twice in a row otherwise the MSI is not installed.

For some reason, in the logs it seems like the installation was successfull, no error whatsoever.
But the MSI is clearly not installed

Diagnostic Logs

install.txt

Copy link

github-actions bot commented Apr 6, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@soragXYZ
Copy link
Author

soragXYZ commented Apr 6, 2024

Copy link

github-actions bot commented Apr 6, 2024

Diagnostic information
Appx package is not installed

@zcobol
Copy link

zcobol commented Apr 7, 2024

For some reason, in the logs it seems like the installation was successful, no error whatsoever indeed, the installation is successful. However, if you run any wsl command, beside wsl --version which returns the help output, from within that window (In the 2nd window, execute install.cmd which installs the MSI) it returns Access is denied. Open a new terminal window and run wsl --version and you'll see that the package was installed.

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 8, 2024

Thank you @soragXYZ.

Looking at the logs, it looks like the registry part of the MSI is missing.

Can you try to fully installing WSL by running: C:\Program Files\WSL\wsl.exe" --uninstall, and reinstall the latest MSI and see if that solves the issue ?

@soragXYZ
Copy link
Author

soragXYZ commented Apr 9, 2024

Thank you @OneBlue

I tried with the latest version of the MSI, ie 2.2.2.0, I still have the same issue

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 9, 2024

Interesting. I'd be interested to look the MSI logs for that.

Can you run wsl --uninstall, and then share the msiexec logs of a new installation ?

@soragXYZ
Copy link
Author

soragXYZ commented Apr 9, 2024

After more testing, it seems like the command wsl --uninstall partially solved my issue:

When I start a new installation by calling install.cmd in the 2nd window opened by PsExec, the MSI is correctly installed because I can successfully run the command wsl --version in a 3rd powershell window and get the expected output.

However, the command wsl --version in the 2nd window opened by PsExec still returns the help.
Am I missing something here ? Why do I need to open a 3rd window ?
Do I have to update env var or something in the 2nd window ?

Concerning my first tests and the error, it seems like I had to install the MSI twice only because I didn't uninstall it correctly at first.

I have an another script used for the uninstallation which basically runs the command :
Start-Process -FilePath "msiexec.exe" -ArgumentList "/X $MsiFile /L*V $MsiLogFile /qn" -Wait -PassThru

Do you recommend using wsl --uninstall over Start-Process -FilePath "msiexec.exe" -ArgumentList "/X $MsiFile /L*V $MsiLogFile /qn" -Wait -PassThru for the uninstallation ?

Thanks for your answers and your time

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 10, 2024

@soragXYZ: There is unfortunately a delay for the WSL installation to complete even after msiexec returns successfully.

This issue is fixed in insider builds, but it's not fixed on older builds yet. This is most likely what you're experiencing

@soragXYZ
Copy link
Author

@OneBlue thanks for the answer

Do we have a release date planned ?

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 18, 2024

Unfortunately not yet. Most likely in the coming months.

@OneBlue
Copy link
Collaborator

OneBlue commented Aug 14, 2024

This should be now available on all recent Windows builds. Closing for now.

Please reopen if the issue still reproduces with the latest windows builds.

@OneBlue OneBlue closed this as completed Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants