2

Using WSL2 on Windows 10, the Linux shell does not recognize commands which are supposed to function. Also, Docker Desktop fails to launch, saying WSL integration stopped and exited with code 1. When I echo $PATH, as suspected, many previously available commands are not included.

enter image description here

But then I run wsl --shutdown in Powershell and start wsl anew. Now all the Windows-related commands are back (ones starting with /mnt/c), and Docker Engine is now able to start. Once it does, the docker and kubectl commands become recognized again also. Now there are way more path variables than before:

enter image description here

What could be the cause of this? I don't want to go through the rigmarole of shutting down and restarting WSL whenever I turn on my machine.

10
  • have you installed tocker and kubectl in your WSL2 Commented Nov 17, 2021 at 18:54
  • WSL is not a real installation so you have not as default the same package list installed. This is the same for the environment variables, so you have to set them all for your needs. Do not forgot to make that in .profile or .bashrc etc.... else you loose your variables at end of session. In case of crash of the WSL session this is similar you loose the unsaved environment variables & then your tools might fail. If you want to use deep applications, & huge applications, use a virtual machine not WSL . This is most for good practices & to avoid this kind od use-cases failures.
    – francois P
    Commented Nov 17, 2021 at 18:55
  • @francoisP WSL2 is a VM, and it is a real installation! But you're right, only the things you install inside your WSL2 machine are in there. Commented Nov 17, 2021 at 18:58
  • It's weird because this didn't use to happen. It only started to happen today, while the previous 2 weeks everything was fine. Commented Nov 17, 2021 at 19:05
  • 1
    @NotTheDr01ds Now I think about it, I might have broken something when running the commands in the top answer here. The last command didn't work, so the whole thing was actually in vain. Commented Nov 18, 2021 at 6:46

0

You must log in to answer this question.