Skip to content

Instantly share code, notes, and snippets.

@mikaello
Last active March 4, 2021 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaello/f6d60d1db8a9a515973fc308fc23f1fb to your computer and use it in GitHub Desktop.
Save mikaello/f6d60d1db8a9a515973fc308fc23f1fb to your computer and use it in GitHub Desktop.
Install WSL2 troubleshooting

Getting started with WSL2

Start by following this guide: https://docs.microsoft.com/en-us/windows/wsl/install-win10. Another nice resource is the blog post Setting up WSL2 and Oh My Zsh.

When running the dism.exe commands during setup you may get an error saying that you need elevated permissions, even if you run PowerShell as admin, you then need to run this command first to get elevated permissions:

Start-Process powershell -Verb runAs

After setting up WSL2 and Windows Terminal, confirm that you have internet connection:

ping google.com

If this does not work, you may need to change how DNS is resolved, see this GitHub issue: microsoft/WSL#5336

You can now install Windows Docker Desktop and make it use WSL2 as backend. If you get errors with permission denied when running docker commands in WSL2, you may need to add yourself in the docker group: sudo usermod -aG docker ${USER}

Some usefull software you may want to install:

sudo apt-get update && sudo apt-get install fd-find silversearcher-ag unzip tree

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

If you want IntelliJ, follow the guide Using WSL 2 to develop Java application on Windows. I had firewall toubles with VcXsrv, this issue answer may fix it (running the troubleshooter) if you got the Windows permissions to run it. Even more troubleshooting here: https://github.com/cascadium/wsl-windows-toolbar-launcher/blob/master/README.md#troubleshooting

VSCode has built in support for WSL2 (remote extension), so that could be installed directly in Windows and used to edit files in WSL2 (as you may already to with files in Docker containers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment