With release of Windows 10 Build 18917, Microsoft introduced WSL 2 to Insiders, the Windows Subsystem for Linux 2. It ships a real Linux kernel with Windows that will make full system call compatibility possible. This is the first time a Linux kernel is shipped with Windows. Windows 10 build 18945 adds more cool improvements to the WSL 2 feature.
WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version).
localhost to connect to your Linux applications from Windows
In the first released build with WSL 2, you needed to access your networking applications via remote IP addresses. We stated that this was high on our priority list to fix, and so we are happy to say that we’ve started this process already by giving you the ability to access your Linux networking apps from Windows with
In the future we want to make sure that you can access your Windows networking applications from Linux using
localhost as well. We’ve prioritized Linux apps from Windows as that’s the most common networking use case, such as a web developer accessing their website in a browser. Stay tuned for more improvements in this area!
WSL global configuration
Since Insider Build 17093 you have been able to configure your WSL distros using
wsl.conf. These options are great to configure individual distros, such as enabling or disabling automounting Windows drives, changing mount locations, disabling interop, etc. However, there are some possible options that need to be applied to all distributions. This has become especially important recently due to WSL 2. All WSL 2 distros are run on the same virtual machine (VM), and therefore any configuration options to this VM will be applied globally to all WSL 2 distros. In this new update we’ve added the ability to start using global config options for WSL. These options are targeted towards power users who want to further customize their WSL experience.
To get started, create a new file called
.wslconfig in your Users folder (
<yourUsername> is your Windows login name). The
.wslconfig file is modelled after an INI file, just like .gitconfig.
We’ve added some initial configuration options, and you can find the full list of what was added in this build here. The most exciting one is specifying a custom kernel!
Using a custom kernel in WSL 2
We provide a Linux kernel with WSL 2, and it’s shipped within Windows. However, there may be a case where you want a specific kernel powering your WSL 2 distros, such as using a certain kernel module, etc. You can now use the
kernel option in the
.wslconfig file to specify a path to a kernel on your machine, and that kernel will be loaded into the WSL 2 VM when it’s started. If no option is specified, you’ll go back to using the Linux kernel provided with Windows as part of WSL 2.
- [WSL2] Allow listening tcp sockets in WSL2 to be accessible from the host by using localhost:port
- [WSL2] Fixes for install / conversion failures and additional diagnostics to track down future issues [GH 4105]
- [WSL2] Improve diagnosability of WSL2 network issues
- [WSL2] Update kernel version to 4.19.55
- [WSL2] Update kernel with config options required for docker [GH 4165]
- [WSL2] Increase the number of CPUs assigned to the lightweight utility VM to be the same as the host (was previously capped at 8 by CONFIG_NR_CPUS in the kernel config) [GH 4137]
- [WSL2] Create a swap file for the WSL2 lightweight VM
- [WSL2] Allow user mounts to be visible via \\wsl$\distro (for example sshfs) [GH 4172]
- [WSL2] Improve 9p filesystem performance
- [WSL2] Ensure vhd ACL does not grow unbounded [GH 4126]
- [WSL2] Update kernel config to support squashfs and xt_conntrack [GH 4107, 4123]
- [WSL2] Fix for interop.enabled /etc/wsl.conf option [GH 4140]
- [WSL2] Return ENOTSUP if the file system does not support EAs
- [WSL2] Fix CopyFile hang with \\wsl$
- Switch default umask to 0022 and add filesystem.umask setting to /etc/wsl.conf
- Fix wslpath to properly resolve symlinks, this was regressed in 19h1 [GH 4078]
- Introduce %UserProfile%.wslconfig file for tweaking WSL2 settings
[wsl2] kernel=<path> # An absolute Windows path to a custom Linux kernel. memory=<size> # How much memory to assign to the WSL2 VM. processors=<number> # How many processors to assign to the WSL2 VM. swap=<size> # How much swap space to add to the WSL2 VM. 0 for no swap file. swapFile=<path> # An absolute Windows path to the swap vhd. localhostForwarding=<bool> # Boolean specifying if ports bound to wildcard or localhost in the WSL2 VM should be connectable from the host via localhost:port (default true). # <path> entries must be absolute Windows paths with escaped backslashes, for example C:\\Users\\Ben\\kernel # <size> entries must be size followed by unit, for example 8GB or 512MB
You can learn more about WSL 2 HERE.
If you are interested in installing it, refer to this official document.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!