Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access WSL2 directory. Have VHDX instead of folder after moving #6123

Closed
abalter opened this issue Oct 20, 2020 · 13 comments
Closed

Can't access WSL2 directory. Have VHDX instead of folder after moving #6123

abalter opened this issue Oct 20, 2020 · 13 comments

Comments

@abalter
Copy link

abalter commented Oct 20, 2020

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.572]
Your Distribution version: 20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL2

Steps to reproduce

In fresh W10 install:

  1. Install WSL2 Ubuntu following usual protocol
  2. wsl.exe --export Ubuntu-20.04 ubuntu.tar
  3. wsl.exe --import Ubuntu <my home directory> ubuntu.tar

WSL logs:

Expected behavior

A folder called C:\\Users\me\Ubuntu is created that has a subfolder called rootfs with the WSL files

Actual behavior

A file called C:\\Users\me\Ext3.vhdx is created. This is not accessable

On my previous laptop I could access my WSL2 distribution from Windows 10 by AppData/Local/Packages.... or \\swl$ on initial install. Ithen moved the distro to C:\Ubuntu, and could access files there directly.

@licanhua
Copy link
Collaborator

licanhua commented Oct 20, 2020

rootfs is for WSL1 only, so it's expected that there is no rootfs in your folder.
You can launch Ubuntu first by wsl -d Ubuntu, then type \\wsl$ in file explorer, then you should be able to access the linux.

@abalter
Copy link
Author

abalter commented Oct 20, 2020

@licanhua -- that's the problem. \\wsl$ doesn't work.

@abalter
Copy link
Author

abalter commented Oct 20, 2020

If I recall, on my previous laptop (with wsl2), I used lxrunoffline and that allowed me to still access the filesytem. Using the wsl commands in the command prompt seems to have messed things up.

@abalter
Copy link
Author

abalter commented Oct 20, 2020

Is there a way I can start over and use the .vhdx to create a new wsl instance that will be sure to allow me to access the files via \\wsl$?

@licanhua
Copy link
Collaborator

Please check the 9p service on linux

@abalter
Copy link
Author

abalter commented Oct 21, 2020

Thank you for the suggestion. That does not seem to be the problem.

(base) balter@ORLT1072346:/mnt/c$ dmesg |grep 9p
[    0.918488] 9p: Installing v9fs 9p2000 file system support
[    0.918511] FS-Cache: Netfs '9p' registered for caching
[    0.964115] 9pnet: Installing 9P2000 support

@licanhua
Copy link
Collaborator

What's the error when you access \\wsl$? How about \\wsl$\Ubuntu?
Because you are still in old version of Windows, \\wsl$ only list active distros, so you may try:

  1. wsl --shutdown to shutdown wsl
  2. wsl -d Ubuntu to launch Ubuntu
  3. access \\wsl$\Ubuntu from File Explorer.

@abalter
Copy link
Author

abalter commented Oct 21, 2020

I am running wsl2, and I have the May 2020 update.

C:\Users\eacriadmin>wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2
  Ubuntu          Stopped         2

Here is the error I get:

image

I get the same error with both of my distros using \\wsl$\Ubuntu-20.04 or \\wsl$\Ubuntu.

I have tried turning it off and turning it on again.

image

@licanhua
Copy link
Collaborator

@SvenGroot Any idea? I can't think of a reason why it doesn't work

@nlezin
Copy link

nlezin commented Oct 30, 2020

I understand your problem perfectly : - ((
I Need to think about how to help You.
I recommend watching the MobaXterm program.
I recently discovered it for myself - I'm excited !!
The free Portable version works great.
Read the description of MobaXterm CAREFULLY on the site.
The program has a LOT of features and everything works.
I highly recommend the MobaXterm program.
Best regards, Nikolay - Moscow.

https://mobaxterm.mobatek.net/download.html

https://mobaxterm.mobatek.net/features.html

PS: just a fantastic program
for features and functionality for WSL2 and Windows !!
How did I find it myself ? - I'm surprised at my persistence.
I am a regular user (now retired), I have been seriously interested in Windows for a long time.
I got interested in Linux recently-I installed it in VirtualBox, then as a system on an SSD disk.
When I accidentally found out about WSL2, I jumped for joy !!
Well, now I'm seriously (for home) studying WSL2 + installing GUI + sound.
Installed EVERYTHING you can from the Windows store:
Kali + kex, Ubuntu, Debian even bought Centos 7 and CentOS 8 :-)
Then I accidentally found it on <github.com> free Centos 7 and CentOS 8.
But I do not regret that I bought Centos 7+8 from Microsoft.
PS2: on Centos 7+8 I can't put the GUI in any way !!
I looked through THE entire Internet-very few people talk about WSL 2 + CentOS :-(
They mostly talk about CentOS installed as a system
in a computer or in a virtual machine.
I am very much waiting for MS to finalize WSL2 and add a "GUI"to it.
They promise to do this soon.

Please write how you understand my advice - I will wait :-)

@miyazakizachary
Copy link

I believe that u wanted to do this because you wanted to share files or dev resources between Os. Well for WSL 2, the workflow is better and make sense. Instead of accessing the drive from Windows, you could access the drive from Linux with 'mnt' command. e.g. /mnt/d

Besides you have better option to open your VSCode from linux command line. So much options in WSL 2 and do not need to use '\wsl$' to access linux folder which I think not a proper integration flow.

Search google: Scott Hanselman, WSL 2 Development

@dmiller423
Copy link

dmiller423 commented Aug 2, 2021

the problem is you need \\wsl$\Ubuntu-20.04 (the full name)

I used net use Y: \\wsl$\Ubuntu-CommPrev /PERSISTENT:YES
for the newer VHDX mounted filesystems on the community preview version

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants