microsoft / microsoft/WSL

Instructions on how to manually install WSL without Add-AppPackage

Open
#9,732 28 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

I am trying to manually install WSL *without* using `Add-AppPackage`. The reason is that service applications (running either as SYSTEM or as a local user, registered under "Services") can not invoke `wsl.exe` because of the sandboxing/permission systems that happens for the `C:\Program Files\WindowsApps` folder / store apps in general. Unfortunately I also need systemd booting capability, so I can not simply using the WSL feature that ships with Windows (it's too old).

To avoid the store app sandboxing, I'm trying to install all the bits of WSL manually with a PowerShell script. Unfortunately I'm stuck on registering COM components - specifically the service server - since store apps have a completely different way of registering their COM components that don't 1:1 align with normal COM registrations. Since there's no source code for WSL, nor debugging symbols on the Microsoft servers, I can't see what interface is missing when I get the following error:

```
Class not registered
Error code: Wsl/0x80040154
```

As far as I can tell, the registrations *look* fine, but since component registration is not documented very well, it's hard to see what I'm missing. I did try installing the WSL feature that ships with Windows, but it apparently doesn't use the same Windows Service/COM architecture that the store version does. This is the script that I've got so far:

(There used to be a PowerShell script here, but I converted it to C#, and it can now be found at: https://src.redpoint.games/redpointgames/rkm/-/blob/wsl-refactor/src/rkm/Components/Windows/WslExtra/WslProvisioningComponent.cs#L156)

Any guidance on what I'm missing here for `wsl.exe` to work would be appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C# provisioning code at src/rkm/Components/Windows/WslExtra/WslProvisioningComponent.cs#L156 and the reported Wsl/0x80040154 error. Investigate how the WSL service server COM components are registered for a manual installation rather than through Add-AppPackage. Done means documenting the missing registration steps so wsl.exe works from a service application while retaining systemd support.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
operating-systems
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.