Allow wsl extension to install the wsl kernel package before attempting to install a distribution #3743
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the pull request
Currently the WSL extension's ability to install and register a WSL distribution relies on calling
wsl.exe --install <distribution name>
. Wsl.exe takes care of installing the distribution for us but we found that if the WSL kernel package isn't installed, wsl.exe (depending on the build) will just output its command line help information without installing the distribution.See issue #3741 for how that would look. In the end our installation times out as we wait for the WSL service to register the distribution in the registry which is done through
wsl.exe
.To fix this we will install the WSL kernel package from the store before starting
wsl.exe --install --distribution <distribution name>
. Note, in the latest builds of Windows,wsl.exe
would do this for the user automatically (e.g install the kernel package from the store). However, that isn't the case in builds like Win 11 22621 or Win 11 22631 as those builds just output the help text if the kernel package isn't already installed.In a future PR after this one we'll make it, so we do not need to call
wsl.exe --install --distribution <distribution name>
to install and register a distribution. That will also prevent the terminal window from popping up.After changes: Video of me installing a distribution when the wsl kernel package is not installed. You'll see we install it from the store (its a system component), and the distribution gets installed and is registered.
Video.of.me.adding.debian.distribution.when.the.WSL.kernel.package.is.not.installed.mp4
References and relevant issues
Detailed description of the pull request / Additional comments
Validation steps performed
PR checklist