wht
wht

Reputation: 28

Can no longer access WSL2 files from Windows explorer or launch Windows programs from WSL2

I've been running WSL2 on Windows 10 for several months now and just recently lost these abilities. I can still open a WSL2 terminal and interact with my Ubuntu installation there.

Accessing WSL2 files from explorer

I could previously go to \\wsl$\Ubuntu and see all my WSL2 files. I can still see the Ubuntu folder at \\wsl$, but when I try to open it I get a loading bar and nothing happens (even after waiting for a long time): Cannot open Ubuntu folder

Also in Powershell: enter image description here

Opening Windows program from WSL2

Previously I could open Windows programs like explorer and VSCode from a WSL2 terminal with explorer.exe and code respectively. Now when I try this the terminal just hangs and nothing opens.

Note that I can still navigate to /mnt/ and see all my Windows files from the WSL2 terminal.


I'm running Windows 10 Version 1909 (OS Build 18363.1379) and Ubuntu 20.04.1.

Upvotes: 1

Views: 9936

Answers (2)

Radoslav Stoyanov
Radoslav Stoyanov

Reputation: 1700

I had the same issue (although on Windows 11). It was very annoying. I noticed that after a restart it was ok, but after a few minutes and almost always after running VSCode, it was breaking again. Here's what worked for me:

  • exporting my distro (wsl --export <Distro> <FileName>)
  • unregistering it from WSL (wsl --unregister <Distro>)
  • uninstalling all WSL-related stuff, like the optional Windows feature, the WSL app from the store (I had them both). I also removed WSLg but I'm not sure if that was necessary
  • restarting
  • installing again the app from the store (no need to turn on the optional Windows feature anymore in case you are on build 22000 or higher)
  • finally just reimporting the distro (wsl --import <Distro> <InstallLocation> <FileName>)

After going through the above steps the issue was resolved and now my WSL2 works like a charm.

Upvotes: 1

NotTheDr01ds
NotTheDr01ds

Reputation: 20640

I'm not sure I have an answer for you, but some general troubleshooting steps to try:

  • Exit your instances and try a wsl --shutdown.

  • If that works, try turning off Windows Fast Startup. Also avoid hibernation. These are known to interfere with some WSL network functionality.

  • Try adding the following section to your /etc/wsl.conf:

    [interop]
    enabled = true
    

    This should be the default, but it wouldn't be the first time we've seen WSL not following the defaults for some reason.

  • Make sure your Windows temp directory is not compressed

  • Make sure your distribution folder under %userprofile%/Local/AppData/Packages is not compressed, especially the LocalState subdirectory where the ext4.vhdx lives.

  • If enabled, try turning off Windows Ransomware Protection

Upvotes: 5

Related Questions