Microsoft is preparing to release an new version of WSL2 (Windows Subsystem for Linux) with Linux Kernel 6.18 (once #40161 is merged) brining it up from 6.6. I was impatient and wanted to try it early to see if it handles the unsupported optional features for ext-4 that I needed.

It was quite easy to set-up, since at this point in time the kernel images had already been built by Microsoft and published as a NuGet package.

Preparation

  1. Download the NuGet package containing the kernel image
     curl -LO https://pkgs.dev.azure.com/shine-oss/13eb32df-d33f-470f-b930-499535a958b4/_packaging/7925a3a1-b93c-4977-8a97-5b877bf2068b/nuget/v3/flat2/microsoft.wsl.kernel/6.18.20.1-1/microsoft.wsl.kernel.6.18.20.1-1.nupkg
    
  2. Extract the kernel image, in my case I extracted it to C:\ProgramData\WSLDistroStorage\kernel\6.18.20.1 as the path C:\ProgramData\WSLDistroStorage is already used by WSL. I used 7-zip but it should be possible to use tar with ZIP support. The two files needed are found in build\native\bin\x64
    • kernel
    • modules.vhd
  3. Configure WSL to use the custom kjernel.
    • Create or open $env:USERPROFILE\.wslconfig / %USERPROFILE%\.wslconfig
    • Add the following content: ini [wsl2] kernel=C:\\ProgramData\\WSLDistroStorage\\kernel\\6.18.20.1\\kernel kernelModules=C:\\ProgramData\\WSLDistroStorage\\kernel\\6.18.20.1\\modules.vhd
  4. Shutdown WSL, wsl --shutdown so it takes affect next time.
  5. Run a WSL distribution
  6. Run uname -r to confirm the version. # uname -r 6.18.20.1-microsoft-standard-WSL2

Summary

Quite simple to set-up the new kernel but I am left wondering if it needs other parts of WSL to be updated to be be compatible with it. I was on WSL 2.6.3.0. While the error about the optional feature disappeared there was another problem with what I was trying to do.