WSL2 with Linux Kernel 6.18"
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
- 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 - Extract the kernel image, in my case I extracted it to
C:\ProgramData\WSLDistroStorage\kernel\6.18.20.1as the pathC:\ProgramData\WSLDistroStorageis already used by WSL. I used 7-zip but it should be possible to usetarwith ZIP support. The two files needed are found in build\native\bin\x64- kernel
- modules.vhd
- 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
- Create or open
- Shutdown WSL,
wsl --shutdownso it takes affect next time. - Run a WSL distribution
- Run
uname -rto 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.