Troubleshooting WSL
When I run into issues with WSL and solve them, I add the problem & solution to this page. Notes may be sparse, I normally only care about what I need to copy/paste to get things up and running.
Problem: Signature errors while working with Azure libraries
While working with Azure libraries in WSL, you might see errors about signatures. Try the following.
Solution: Set ntpdate
Edit /etc/wsl.conf
and modify the [boot]
section as follows. If you do not see a [boot]
section, simply create it, and if any of the options below are already present, do not repeat them:
Modify /etc/wsl.conf to fix Azure tool signature errors | |
---|---|
After modifying this file you will need to restart WSL. You can do this with wsl --shutdown
, then re-launching your WSL distribution.
Problem: Ping doesn't work in WSL
When trying to run ping
in a WSL distribution, you may see an error like this:
Ping error in WSL container | |
---|---|
The problem here is the line missing cap_net_raw+p capability
.
Fix: Add cap_net_raw permission
In the WSL container, run this comand:
Fix for all WSL2 distributions
To fix this for all distributions, you can modify the kernelCommandLine
flag in the [wsl2]
section of %USERPROFILE\.wslconfig
.
Fix ping for all WSL2 distributions | |
---|---|
Problem: WSL is completely frozen
This happens sometimes when I'm using the VSCode remote extension to connect to a WSL distribution and the computer goes to sleep. WSL becomes completely responsive, ignoring all commands including wsl --shutdown
.
Fix: Kill the wslservice.exe task
Problem: Git is not working in WSL
When git
is installed on both the Windows and WSL side, you will often run into errors, specifically around authentication.
Fix: Use Windows git credential manager in WSL
Run the following 2 commands, the first on the Windows side and the second in a WSL distribution.
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe
If your Git remote is Azuree DevOps, you also need to run: