I'm working on a project with a virtual machine that has an isolated network, but I'm running into issues with Windows Subsystem for Linux (WSL). Here's the situation:
### Symptoms:
- I can start VSCode from WSL, but it opens on the host machine instead of WSL.
- When I try to switch VSCode to WSL, I get a "could not fetch" error.
- Using the command "wsl --shutdown" hangs the terminal, and I can't reconnect to WSL without restarting the whole VM.
Docker isn't working either, though I'm not sure if it's related to this issue.
### Possible Cause:
I mistakenly used `wsl --unregister` but canceled it right away about a week ago. It was functioning normally until yesterday when I rebooted the VM for the first time in a while. I suspect that the reboot might have made my earlier mistake come to light.
### Attempted Solutions:
Not much, as I haven't found helpful information online. I even tried consulting AI, but they just suggested shutting down WSL or rebooting.
### My Questions:
- How can I fix these issues?
- Is there anything aside from my unregister mistake that might be causing this?
Thanks in advance for any help!
3 Answers
Try launching VSCode directly from the WSL instance with the path, like `/usr/bin/code`. This should help it connect to WSL instead of the Windows version. You can check the correct path for VSCode by using the command `which code` in WSL.
Don't forget to update WSL. You can try the command `wsl --update`. This sometimes resolves lingering issues by bringing your installation up to the latest version.
Have you thought about removing the WSL feature completely? You can do this in Control Panel under Windows features or with PowerShell using `Disable-WindowsOptionalFeature -online -featurename “Microsoft-windows-subsystem-linux”`, then reboot and enable it again before reinstalling your WSL distro. It could fix your issues.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures