Local Community

WSL 2 Support in Local

I don’t think we have a proper feature request thread for WSL (2/G) support inside of Local. I think we’ve had some support or workflow threads here and there but nothing formal here in Feature Requests.

Summary: Looking for Local Linux supporting WSL with all its current features, site domains, extensions, etc - currently works with limited number of distros and site domain (example.local) does not function properly forcing you to run in localhost port forwarding mode. We also have issues when using WP CLI forcing us to modify the wp-config file and the DB address to include/point to the mysql socket file that Local generates for each site (during provisioning I believe?)

What is WSL ?
WSL is is Windows Subsystem for Linux, in essence it allows you to run GNU/Linux environments/distros directly on Windows. WSL 2 introduced ELF64 Linux binaries on Windows working towards achieving full system call compatibility. WSLg brings support for running Linux GUI applications directly on windows (well inside of WSL) but as standalone applications rather than the traditional full VM experience, without ever installing or using the Linux GUI itself. These applications show up and are launchable as normal Windows application through your start menu.

What doesn’t work currently with Local and WSL?

Local currently runs into an issue during its modifying of host files, being unable to do so, prevents site provisioning and sites to start/launch. Switching the router mode to localhost and accessing each site over its respective assigned port does allow Local to work*.

Local appears to have multiple instances, launching through /opt/Local/local and launching through sudo local, only launching through /opt/Local/local works properly but they have separate Local Sites folders/installation directories. After launching through /opt/Local/local and completing the setup launching from the Windows Start menu will launch this version.

Its namespace should also be changed to localwp as local is often times reserved namespace in Linux configurations.

Local does not install its dependencies or all of them during installation, during installation you’ll get a handful of errors for additional software packages it needs but doesn’t install itself, you’ll only be able to fully install it by installing these yourself.

WP CLI out of the box does not work - you return an error about being unable to connect to the database of the site even though WP CLI is installed and configured properly. We ultimately end up having to modify our WP Config files DB Host address to the mysqli socket file and folder location that is generated by Local during site provisioning. After doing so allows CLI to communicate to the DB, ideally this should work out of the box if CLI is installed properly.

As of the latest versions of Local this is appears to be fixed, at least for Ubuntu but conflicting information on other distros: Open Site or Open Admin buttons don’t open the web browser in windows, often times do nothing. (I am no longer personally experiencing this bug but the manner in which is does so through the multiple powershell popup windows that then automatically close do make you unable to do anything until it finishes processing and opens)

Final just point of reference Local CLI appears to only support Mac, it looks for the GraphQL auth token file location in the Mac install location, ideally this should be expanded to Windows & Linux, in turn adding Linux support should add WSL support.

Appreciate any input anybody might have on this manner.

@austinwendt tagging to try and get some attention from your (just mean company/team) side to these issues.

1 Like