Updating the kernel for the Windows Subsystem for Linux 2 (WSL2) can enhance performance and functionality, allowing users to leverage Linux applications seamlessly within a Windows environment. Here’s a straightforward guide to help you navigate this process effectively.
Steps to Update WSL2 Kernel
Step 1: Begin by adjusting the kernel version as needed. This foundational step ensures that your system is prepared for the subsequent updates.
Step 2: Assign a unique name to the kernel using the following command:
scripts/config --file Microsoft/config-wsl --set-str LOCALVERSION "-custom-microsoft-standard-WSL2"
If you desire further customization, you can access the configuration editor with this command:
make menuconfig KCONFIG_CONFIG=Microsoft/config-wsl
Step 3: To create the kernel, execute the following command:
echo 'yes' | make -j $(nproc) KCONFIG_CONFIG=Microsoft/config-wsl
Next, install the necessary modules with:
sudo make KCONFIGCONFIG=Microsoft/config-wsl modulesinstall
Step 4: Navigate to Windows Explorer and access the Linux environment through the Linux entry in the navigation pane. From here, copy the vmlinux file from your home directory to the Windows user profile located in the WSL folder (C:Users[username]WSL).
Step 5: In your Windows profile folder, create a .wslconfig file and input the following lines:
wsl --list --online
Be sure to replace the placeholder [username] with your actual user name.
In PowerShell, terminate all running WSL instances using:
wsl --list --online
Finally, to verify the new kernel version, start Linux in the Windows Subsystem for Linux and run:
wsl --list --online
This guide, originally featured in PC-WELT and translated from German, aims to simplify the kernel update process for WSL2 users, enhancing their experience with Linux applications on Windows.
<h3 class="articleauthorhead”>Author: Thorsten Eggeling
Thorsten Eggeling has been writing articles for PC-WELT for over 20 years, sharing insights and expertise in the realm of technology.