WSL1 and WSL2
Last updated
Last updated
This topic is: advanced
If you know how to use Linux and you are comfortable using it, you can do this.
When WSL was introduced, the virtualization technology was different.
WSL1 was more "integrated" in Windows, just like running a trimmed version of the Linux kernel alongside Windows. This improves performance but has its limitations regarding Linux kernel usage.
WSL2 is the new version more "virtualized" than WSL1, it means it runs inside a virtual machine. This allowed to run the entire Linux kernel without problems, keeping the integration with Windows.
TL;DR: the new version of WSL2 replicates the "true Linux" kernel, and with that, many internal things work "as it should be", but at the cost of performance.
You can check what version of WSL are you using with your distro.
To view the WSL version of your distros, run this command in Powershell:
To view default distro and WSL version for new distros:
Set default WSL version for new distros:
Set version 2 for specific distribution:
This guide will continue using WSL 2.
Systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.
WSL2 can run Systemd, this means software that depends on that service will work, and the experience on WSL will be closer to "using a bare metal Linux machine".
To check if you are using Systemd or not, run this command:
To enable Systemd on WSL2, you need to edit /etc/wsl.conf
. I recommend using micro as text editor (you need 'sudo' for this).
In that file, you must put this:
Save it and now restart WSL using wsl --shutdown
. Now your distro will be using Systemd.