WSL

Q: How do I access Linux files in my WSL from Windows?

A:  In Windows, Start|Run to \wsl$, find the share for the WSL instance you want, then browse to the file.  The share is always listed even if the WSL instance is not running.  WSL will automatically launch the instance once you attempt to access anything in the share; startup time is seamless.  File privileges are non-root, however, as they are equivalent to the default user.  Editing protected files can only be done from a command line using sudo as usual.

Source:  Click here

Q: In WSL, I cannot start apach2 with an error "make_sock: Could not bind to address [::]:80", but nothing else shows as using the port?

A: Something on the Windows host, almost certainly IIS, is using port 80/443.  WSL processes share ports with the Windows host and do not support Windows port sharing.  Therefore, if Windows is using port 80, WSL cannot, and vice versa.

To fix the most common cause:

Start IIS Manager console.

In the left-hand pane, make sure the root node is selected.

In the right-hand Actions pane, click Stop.

Q:  I can't find httpd.conf in Ubuntu/WSL.  Where is it?

A:  Ubuntu does not use httpd.conf.  Instead, use /etc/apache2/apache2.conf.


Q:  On Windows, netstat reports process ID 4, is using port http, but this is the System process. What is actually using port 80?

A:  Windows uses a kernel-level http service to permit port sharing, thus for port 80 or 443, the process name displayed is typically unhelpful.  An easy way to identify services dependent on it - and stop them if you need - is to run "net stop http" from a command line.  If any other services are using http via the port-sharing interface, those services will be listed, though note that http itself will likely fail to stop.  This is OK, just ignore this error.

Q:  Ubuntu 16.04 under WSL reports "Failed to connect" when I run shutdown.  How do I shutdown Ubuntu under WSL?

A:  Do so from Windows instead of inside the Ubuntu WSL.  Follow these instructions:

1. Start an elevated Windows command prompt
2. Enter wsl --list to get a list of running Ubuntu WSL VMs.
3. Locate the name of the WSL to kill.
4. Enter wsl --terminate <UbuntuName>

Comments