< Alle Themen

WSL2+ Kernel V6 Howto for Windows 11

# WSL2+ Kernel V6 Howto for Windows 11
Version 1 02/2024 by toxwood (
Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution (Howto uses Ubuntu 22.04.3 LTS) are
as follows:

# Ubuntu 22.04.3 LTS Requirements
Open a WSL terminal window and launch the distro of your choice.

Install the required packages to build the kernel:

`sudo apt update && sudo apt upgrade && sudo apt install bc dwarvesbc pahole build-essential flex bison libssl-dev libelf-dev`

Clone the Microsoft Linux kernel repository from GitHub:

`git clone –depth=1 -b linux-msft-wsl-6.1.y`

Change directory to the kernel source code:

`cd WSL2-Linux-Kernel`

# Build the Kernel:

`sudo make KCONFIG_CONFIG=Microsoft/config-wsl`

Install the kernel modules and headers:

`sudo make modules_install headers_install`

# Installing the Kernel:

Copy the kernel image to the Windows file system:

`sudo cp arch/x86/boot/bzImage /mnt/c/wslkernel`

Open Windows Explorer copy the kernel from the “c:\wslkernel” folder to the root of C:\
(Windows security confirmation required).

Exit the WSL terminal window.

# Using the Kernel

You can configure WSL to use it instead of the stock kernel as follows.
Create or edit the file `%USERPROFILE%\.wslconfig` with the following content:



Open a PowerShell terminal window as Administrator and Stop the WSL instance:

`wsl –shutdown`

Now you can now launch your WSL2 distro and check the kernel version as follows:

Open a WSL terminal window and launch the distro of your choice.

Check the kernel version:

`uname -r`

You should see the following output:


# Documentation