WSL2: How to install a custom kernel and get free performance!

Windows Subsystem for Linux, an amazing utility which allows you to run 2 different OSes at the same time has been a boon in our lives! But you can actually squeeze a little bit more performance from your WSL2 with custom kernel and be safer at the same time!

As we all know, Microsoft had to open-source the Linux kernel they used for WSL2, under the GPL v2 requirement, and we can now benefit from that and install a kernel built by us!

This can be achieved in a few simple steps. Assuming that you have a WSL2 distro installed already, you need to do the following:

  • Open file explorer, go to C:/Users/yourusername and create a file named .wslconfig
  • Open the file with your beloved editor, we use Notepad++ for these things
  • Write these lines as shown in the image:
kernel=C:\\Users\\yourusername\\bzImage              # An absolute Windows path to a custom Linux kernel.

Now, download any custom kernel you want, place it in the same directory as this file, restart WSL2 and voila! You have your own custom kernel setup which you can enjoy! If you want, you can use my custom kernel for you WSL2 install, check it out here!

Wondering how my Windows Terminal looks so good? You can make that too with a few lines! Read about it here! Also, remember to share this tutorial if you liked it 🙂

Leave a Reply