DEV Community

EZZAHIR Taha
EZZAHIR Taha

Posted on

WSL Error: Failed to Execute Process and Get User ID

This error message usually occurs when there is an issue with the permissions of the user account running WSL.

One cause of such error is that the default WSL distro is set to docker install. In this case you can find which distro is currently a default distro with wsl -l command and change it to right one with wsl -s command.

Another solution is to fix the problem is to reset the WSL distribution, which will recreate the distribution files and fix any permission issues. Here are the steps to reset the WSL distribution:

  1. Open PowerShell as Administrator.
  2. Run the command wsl --shutdown to stop all running WSL instances.
  3. Run the command Get-ChildItem -PathHKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {&{"Unregistering $($.pschildname)"; &reg.exe delete "$($.pspath)\Flags" }} to unregister all the installed WSL instances.
  4. Run the command wsl --list to confirm that no WSL instances are listed.
  5. Run the commandwsl --import <DistributionName> <InstallLocation> <FileName> to import a new WSL distribution.
  6. Run the command wsl --set-default <DistributionName> to set the new distribution as the default.
  7. Replace <DistributionName>with a name of your choice, <InstallLocation> with the location where you want to install the distribution, and with the name of the .tar file that contains the distribution.

After following these steps, you should be able to run WSL without any errors.

Top comments (0)