At the best, you'd get an extremely unoptimized WSL system. At worst, it just won't start.
I did try (half-heartedly) to run the 5.15 kernel under WSL:
- Downloaded and installed the
- Copied the
vmlinuz-5.15.0-051500-generic over to a directory in my Windows user profile
- Edited my
%userprofile%\.wslconfig to add the appropriate kernel pointer
Attempting to start any of my WSL instances (any distribution) failed. No error, just locked up the
wsl command until I issued another
wsl --shutdown in another PowerShell session.
I say "half-heartedly" because I could go further with this. Looking at the existing WSL kernels, they appear to be uncompressed. So I could have attempted to uncompress the Ubuntu kernel.
But regardless, I just didn't have high-hopes of this paying off (or being very useful).
Note that Microsoft does maintain its own WSL2 kernel repository with the modifications needed to optimize for WSL2. At the very least, the
.config is very different than that of the Ubuntu stock kernel configuration. I spent a bit of time scanning a
vimdiff of the two out of curiosity, but I'm not an expert in kernel configuration by any means.
Things like virtualization are already enabled in the stock Ubuntu kernel, so that's not an issue. But one things that did stand out to me is that a stock Ubuntu kernel is, of course, expecting physical or even virtual "hardware" that supports power management. WSL does not. There's no "Power on", no "Suspend", etc. If the power management subsystem (ACPI) puts the system to sleep under WSL, there's no "waking it up".
There are a huge number of other differences between the two. I'm sure many of these are optimizations (or even requirements) on the WSL end.
Btw, it appears that there is a slightly newer release of the Microsoft supplied kernel. Last week saw the release of
linux-msft-wsl-18.104.22.168. It should be available soon for
wsl --update (or via Automatic Windows updates). Or you can download and compile yourself from the provided source.