WSL 2 not only loads a native Linux Kernel, the image of the Linux Kernel is in the directory C:\Windows\System32\lxss\tools, but it also gives us the option of loading a customized Linux kernel. That’s right, we can compile and customize our own kernel to be loaded into WSL 2.
[wsl2] # An absolute Windows path to a custom Linux kernel # kernel=C:\\Users\\<seuUser>\\vmlinuz-6.1.21.1-WSL2-msft # kernel=C:\\Users\\<seuUser>\\vmlinuz-6.6.10-WSL2 # 50% of total memory on Windows or 8GB, whichever is less # memory=8GB # Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6 # kernelCommandLine = vsyscall=emulate systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all # kernelCommandLine = vsyscall=emulate systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=named
# cat /proc/version Linux version 6.1.21.1-microsoft-standard-WSL2+ (root@debian-testing) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP Fri Apr 14 16:30:28 UTC 2023
Stable Linux Kernel
1 2 3
# cat /proc/version Linux version 6.2.11-microsoft-standard-WSL2 (root@debian-testing) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Fri Apr 14 14:53:28 UTC 2023 Linux version 6.3.2-microsoft-standard-WSL2 (root@debian-testing) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Mon May 15 04:22:52 UTC 2023