Can you install any other distros in Win10's "Windows Subsystem for Linux"?

The "Windows Server Installation Guide" links to "Manually download Windows Subsystem for Linux distro packages", which mentions several distributions that are officially provided: Debian, Kali, Ubuntu, OpenSUSE, Fedora, and SLES

Since we have Debian and Slackware based distros at hand:

  • Is it possible to use any distributions/tree other than those, such as Arch?
  • Are there any downsides to not using the official distributions?

I am particularly interested in a way that avoids using the Windows Store, as it can be blocked by Group Policies.


This is tested in Windows 10 v1709 and the procedure may change in future Windows 10 builds

  1. Compile Installer:
    We have to compile an executable to call the WslRegisterDistribution() function:
    (not expected for this documented function to change)
    #include <Windows.h>
    #include <stdio.h>
    
    typedef HRESULT (WINAPI* RegisterDistro)(PCWSTR distroName, PCWSTR tarGzFilename);
    
    int main() {
      int wargc;
      wchar_t** wargv;
      wargv = CommandLineToArgvW(GetCommandLineW(), &wargc);
      HMODULE dll = LoadLibraryExW(L"wslapi.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
      RegisterDistro func = (RegisterDistro)GetProcAddress(dll, "WslRegisterDistribution");
      HRESULT result = func(wargv[1], wargv[2]);
      (result == S_OK) ? printf("%ls installed\n", wargv[1]) : printf("Error: 0x%x\n", result);
    }
    
    Compile this with any C compiler (e.g. gcc), letting the executable name Wslnstall.exe (needed for step #3), and I have a compiled version of this in my GitHub repository

  2. Download .tar.gz RootFS:
    There are many ways to get the RootFS of a distro (e.g. from ISO file, from docker image, using debootstrap command etc.) and from my personal experience, there are some conditions that to be present in that .tar.gz file, such as the .tar.gz file should be compressed with gzip only, contain a valid /bin/bash or /bin/sh binary, and /etc/passwd file (as usual).
    • These are just guidelines users may skip, and here I omit these steps with a direct link to a pre-built .tar.gz for Alpine (only download the .tar.gz)

  3. Install:
    Place the compiled executable (step #1) and .tar.gz (step #2) within the same folder you want to install, running from within that folder:
    # WslInstall.exe <distro_name> <file_name.tar.gz>
      WslInstall.exe Alpine alpine-minirootfs-xxx.tar.gz
    

The Alpine distribution should now be installed.