Windows Subsystem for Linux 2

I am running manticore search and redis within my Ubuntu 22 on top of Windows Subsystem for Linux 2 (WSL2) this allows me to connect my Windows development environment (Internet Information Services - IIS) to use linuxy development tools that don't change and match the Amazon Web Services (AWS) cloud components.  Up until I yesteday I was able to use localhost as the connection string or dns name for calls between my host Operating System (Windows 10) and my linux running images.  Then today after applying the release build 10.0.19045 everything broke and was no longer functioning.

Why??

From what I could tell connections were not being opened to linux image processes.  For example if I tried to login into manticore like so mysql -h 127.0.0.1 -P9306 no response/unable to connect.

  • Check with netstat for the port running and it's not showing as a running process with a port.  (Be careful ran into issues with trying to find the port with netstat and pipe.  These two options work netstat -an | findstr "9306" and netstat -an | find """9306""" <- This one is weird but needs the triple quotes because of the pipe formatting)
  • Now go check the atest configuration changes from WSL2
Advanced settings configuration in WSL
A guide to the wsl.conf and .wslconfig files used for configuring settings when running multiple Linux distributions on Windows Subsystem for Linux.

I don't have a .wslconfig file in my user folder C:\Users<your user>\.wslconfig because I have been using WSL since it's beta so I only have a wsl.conf file and the setting here

Doesn't exist and the default if the file doesn't exist doesn't seem to be true but instead false becase none of the port forwarding is working so

Create a .wslconfig file in the folder C:\Users<your user>\.wslconfig and add this line

[wsl2]
localhostForwarding=true

Restart wsl

  • wsl --shutdown
  • wsl

Alternate way (I use this method most of the time)

  • Run command services.msc
  • Find the service LxssManager and restart

And now the connections are passing through from host to linux image on matching ports so everything is back to working.  Yay!