What’s new for WSL in Insiders Preview Build 18945

Craig Loewen

Craig

A new Windows insiders build has just released, and it contains some hot off the press features for the Windows Subsystem for Linux (WSL)! We’ve added the ability to access Linux networking applications in a WSL 2 distro from Windows with localhost, as well as global configuration options that will give you greater control over your Linux distros, such as specifying a custom kernel for the WSL 2 Virtual Machine (VM). You can find the full release notes for the WSL updates in this build here and you can view all of the updates in this build here.

Use 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 localhost.

Connecting to a nodeJS site using localhost in WSL 2

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 ( C:\Users\<yourUsername>\ where <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.

Tell us what you think!

If you run into any technical issues using this build please file an issue on our Github repo: Microsoft/WSL. Additionally, if you have any WSL related questions or want to stay up to date with WSL news you can find a list of WSL team members that are active on Twitter here.

We’ll be looking forwards to delivering more updates in the future.

Craig Loewen
Craig Loewen

Program Manager, Windows Developer Platform

Follow Craig   

19 Comments
Avatar
Scott Crossan 2019-07-26 12:23:01
Really glad the localhost support had been added. Won't need to update my connections and hosts file anymore. Loving WSL 2 so far.
Avatar
10976595 2019-07-26 12:51:32
Pretty useful. I struggled last time on accessing mysql DB in wsl from my host. Good job.
Avatar
Cecil Chappelow 2019-07-26 14:17:03
Has the inability to make a network connection, while using a VPN, been resolved? The work around cited here is not working for me: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting
Avatar
Edens, Dan 2019-07-26 15:06:34
This is by far the most underhyped annoucement page I've ever seen..  dropping bombs! you guys are seriously on fire lately.
Avatar
Robert Castles 2019-07-26 15:11:36
Who thought we'd be this far along this fast?  WSL 2 is amazing
Avatar
Fleet Command 2019-07-26 22:00:02
Can we run Docker on WSL?
Avatar
Max 2019-07-27 01:16:29
Thank you for the amazing progress! Addition of localhost is fantasitc and WSL is the most important project on Windows atm. Can't wait to have the final release with new terminal together. 
Avatar
Damien Solodow 2019-07-28 18:34:02
Is the WSL Hyper-V switch still used by WSL2 in 18945+?
Avatar
Aleksey M 2019-07-29 03:57:01
WSL2. If I add "127.0.0.1 mysite" in "windows/hosts". Will "http://mysite" work too? or localhost only?
Avatar
Santiago Molina 2019-07-29 06:08:44
before this support to localhost I was using export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 for exporting the DISPLAY variable, which was working fine. Now with this I'm doing export DISPLAY=localhost:0, which doesn't work. Any idea?
Avatar
Antonio Landolfi 2019-07-29 16:12:11
The sad thing is the location where you have chosen to put the config file. I'm really annoyed by all of these dotted files and folders, please follow your own guide lines on Windows and follow XDG specs on Linux!
Avatar
Robert Rodriguez 2019-07-29 17:58:24
I converted 2 smaller distributions successfully from WSL 1 to WSL 2, Ubuntu and Kali. However, I'm not having much luck copying a fairly large (8gb+) Pengwin distribution to version 2. First I tried -set-version 2, and that copied ok (after a couple of initial attempts failed with a "write error" but then when you try to run pengwin it hangs up forever. Next I tried exporting to a file and then importing to version 2. This time it fails  with "specified network name no longer available" after importing the file to version 2. I'm not sure what network name it would be looking for.
Avatar
Amir Shiri 2019-08-02 07:08:35
I can't make localhost work. I'm using Ubuntu WSL 2. inside WSL, "wget localhost:4200" works. On Windows it doesn't - I get "Unable to connect to the remote server". Using build 18950.1000. Even using the IP from eth0 doesn't work, though I do have ping from Windows to the WSL IP. Where can I get help for this issue?