dkapur17
dkapur17

Reputation: 516

Still able to use Explorer to view WSL files after reverting from WSL2 to WSL1 – is this normal?

I am a big fan of Windows Subsystem for Linux (WSL) and was totally psyched when they announced WSL2. However, the official Docs said that WSL2 isn't as performant as WSL1 when it comes to working with files in the Windows File system. This is kind of a bummer because most of my work is in the Windows File System itself and I would like to keep it that way.

But for the sake of checking it out, from PowerShell (could also be run from cmd.exe) I converted my main Distro to WSL2:

wsl.exe --set-version Ubuntu-18.04 2

The conversion was successful. Then – from WSL, logged in as root – when I ran

cd
explorer.exe .

it launched File Explorer in Network\wsl$\Ubuntu-18.04\home\user. I knew that this is a feature in WSL2; that we could access the Linux file system using the Windows Explorer.

However, I then decided to revert back to WSL1 (file system access). So I ran the command:

wsl.exe --set-version Ubuntu-18.04 1

And just to cross check, running

wsl.exe --list --verbose

lists my main distro as running version 1.

But now if I head over to WSL and run cd ~; explorer.exe ., it still opens up the directory in the File Explorer! As far as I know, this normally gives the error that windows can't access file paths with the Linux structure or something like that when run with WSL1.

So I was wondering if this is normal, or did it happen because of the reversion, or did I somehow break my installation?

Upvotes: 14

Views: 26912

Answers (2)

Gh111
Gh111

Reputation: 1452

Type this command to grab the version of distro

wsl -l -v

Then type this command to roll back / set default version

  wsl --set-version Ubuntu-20.04 1

It will output something like - Conversion in progress, this may take a few minutes...

Then try wsl -l -v command again, and check the result

In my case results before and after are

  NAME                   STATE           VERSION
* Ubuntu-20.04           Stopped         2
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2

and after

  NAME                   STATE           VERSION
* Ubuntu-20.04           Stopped         1
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2

EDIT

Actually I read description of the question, after leaving this comment, and I guess I'm not answering on it at all, but I have decided to leave it here, because it can be helpful for someone who are trying to figure it out!

Upvotes: 18

NotTheDr01ds
NotTheDr01ds

Reputation: 20640

Sounds "Normal" to me. Support for accessing WSL files safely from Windows was added to WSL1 in Windows 10 version 1903 a bit over a year ago. See https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/

I guess I'm more surprised that you received an error message with 2004 when trying to access WSL1 from Explorer. Perhaps you were just assuming it would still fail from your experience pre-1903?

Upvotes: 10

Related Questions