microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.42k stars 823 forks source link

WSL2: can't access linux file system from windows #4260

Closed martaver closed 5 years ago

martaver commented 5 years ago

Please fill out the below information:

martaver commented 5 years ago

Note: running explorer.exe . from a mounted windows drive, e.g. /mnt/c works fine.

This is a blocker, preventing me from opening a project located on the linux file system in VSCode.

onomatopellan commented 5 years ago

Things I'd try: -Try using the real bash terminal or the new Windows terminal, not the one inside Vscode. -Look at /etc/wsl.conf content. (that /c/WINDOWS/ is fishy) -See dmesg output to see if it tells what's happening.

martaver commented 5 years ago

I am mounting /mnt/... drive directly under / in my wsl.conf...

I ruled that out, though, because explorer.exe . works fine from within the mounted drive at /c/...

Would you mind giving me some more information on how I can debug this using dmesg?

VSCode remoting to WSL works quite nicely, btw.

craigloewen-msft commented 5 years ago

Another troubleshooting idea: If you go into File Explorer and type in: \\wsl$\<yourDistroName\ into the address bar (replacing with the name of your distro which you can see from wsl -l), does that work or does that result in an error?

martaver commented 5 years ago

Ah, so from File Explorer, browsing to \\wsl$\Ubuntu-18.04\ gives me error:

\\wsl$\Ubuntu-18.04 is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Attempt to access invalid address.

Can't quite tell if this is a permissions issue, or 'invalid address'... any ideas?

craigloewen-msft commented 5 years ago

This seems to be an error with the Plan 9 server. @SvenGroot is the resident expert for this area!

erikhakansson commented 5 years ago

I suddenly have this issue too after upgrading to 18932. It worked previously but with issues (#4262)

erikhakansson commented 5 years ago

sudo apt update && sudo apt upgrade followed by wsl --shutdown and then starting wsl again resolved the issue for me.

But I don't know if it's permanently or not.

martaver commented 5 years ago

@erikhakansson's steps didn't change the problem for me.

onomatopellan commented 5 years ago

@Martaver I think your issue it's very similar to #4027 Keep reading and try the registry workaraound that Sven suggested in that thread.

stuffaboutpete commented 5 years ago

I'm struggling with the same and the linked issue wasn't my problem - the registry values were already correct. apt upgrade also made no difference although running wsl --shutdown is helpful because it saves logging out or rebooting.

peidaqi commented 5 years ago

Same here.

\wsl$ is very unstable and drops from time to time. This seems to have something to do with number of writes - I often have the problem after working with a project from VSCode (and save the files several times).

It can be decieving that sometimes \wsl$\ can still be accessed, but this is from cache. If you try to actually open the files using notepad/vscode you will still have a filesystem error.

Restarting WSL with wsl --shutdown seems to fix it temporarily.

enterit commented 5 years ago

Ah, so from File Explorer, browsing to \\wsl$\Ubuntu-18.04\ gives me error:

\\wsl$\Ubuntu-18.04 is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Attempt to access invalid address.

Can't quite tell if this is a permissions issue, or 'invalid address'... any ideas?

I am seeing exactly the same issue on my Windows 10 1903 18941.1001. Updating Ubuntu or restarting WSL did not help. @Martaver, have you by any chance figured out how to fix this?

shm-tar commented 5 years ago

Exact same issue on Windows 10 1903, but when running explorer.exe inside WSL, it opens Windows explorer on This PC page.

David-Defoort commented 5 years ago

I've updated to 1903 18362.356 as of yesterday and I'm having this issue as well

I tried to:

I have another PC where that works as expected on 1903, explorer.exe . etc...

abreingan commented 5 years ago

Hi I seem to have exactly the same problem as David-Defoort, but with the Debian distro. 1903 18362.356 also.

aleblanco commented 5 years ago

Another troubleshooting idea: If you go into File Explorer and type in: \\wsl$\<yourDistroName\ into the address bar (replacing with the name of your distro which you can see from wsl -l), does that work or does that result in an error?

This solution worked perfectly for me. Thanks!

abreingan commented 5 years ago

I am now on 10.0.18362.388 and retried the disable wsl and that was successful (not sure if this is permanent or not). I started cmd with admin authority and entered "wsl -t Debian" After that File Explorer and enter \wsl$\Debian\ works.

ferlauf commented 5 years ago

When it happens, I usually do "Get-Service LxssManager | Restart-Service" from the PS (Run as administrator). I'm currently on 10.0.18999.1 and it seems WSL is a bit more stable now.

benhillis commented 5 years ago

There have been a handful of fixes around the \wsl$\ paths so things should be much more robust now. Please reopen a new issue if you continue to see issues after build 19002.

fracasula commented 4 years ago

It would be great if it'd be possible to map a network drive that points to a folder in the Linux subsystem:

Annotation 2019-11-19 083927

Unfortunately that doesn't work and I don't see other options for editing those files with editors like JetBrains' (I'm talking about running the editor from the host, not the VM of course).

Any ideas?

raphaeldisanto commented 4 years ago

fracasula, come at it from the other angle.

All of your windows files are accessible from within the linux distro under /mnt/, so just store the files there. That way, both windows and linux has access to them.

SvenGroot commented 4 years ago

@fracasula Does simply mapping \\wsl$\Ubuntu-18.04 not work for you? You should be able to do that and then access the folder as Z:\root\Code.

Is there any reason you have to map the specific folder to a drive?

whaaaley commented 4 years ago

I was still having this problem up until today. Previously, my lowercase file path worked, \\wsl$\debian, but reading https://github.com/microsoft/WSL/issues/4260#issuecomment-507841709 I tried uppercase to see if it fixed anything, \\wsl$\Debian, and it worked, and it also made the lowercase paths start working again. So check your casing. Weirdly, shortcuts with the uppercase version do not work, only the lowercase version. This is a very annoying inconsistency. Every time I start windows I have to type in the wsl path in explorer to open any projects.

fracasula commented 4 years ago

fracasula, come at it from the other angle.

All of your windows files are accessible from within the linux distro under /mnt/, so just store the files there. That way, both windows and linux has access to them.

I did not know that was possible, thanks 👍

whaaaley commented 4 years ago

FWIW. I was having issues with file watching when storing files Windows side, so depending on your needs, accessing files via /mnt may not be viable.

phelps-matthew commented 4 years ago

For some others that encounter the same error, my case was able to be resolved by Set-ExecutionPolicy Unrestricted in powershell. Previously I had changed it to remotesigned, and this was the source of not being able to access the /mnt directory.

Msadr471 commented 4 years ago

Hi in this picture, you can see I don't have access my directory: image

What is this?? thinclient_driver?! image

also, I don't have access to the root folder?! Why? image

how can I set root forever when I open it. image

whaaaley commented 4 years ago

This is still an issue in March 2020. It happens 50% of the time. Sometimes it randomly starts working after 50 tries.

fjeddy commented 4 years ago

Ditto, latest windows 10 stable build, keep losing the WSL connection every few hours. So far the only "fix" is to reboot the entire computer.

abreingan commented 4 years ago

I managed to temporarily fix this by starting a cmd with admin authority and entered "wsl -t Debian" (the name of my WSL instance) After that start File Explorer and enter \wsl$\Debian\ works. You might also add you comment on to the open issue i started after this one was closed. It is WSL2: can't access linux file system from Windows Explorer #4812

whaaaley commented 4 years ago

I gave up trying to get this to work consistently, I bit the bullet and moved all my projects out of WSL and rewrote my file watching scripts to work with Window's janky file change events :) ~ I'm about to buy another SSD just so I can install Debian... It's starting to not be worth the headache... Honestly...

This thread shouldn't have been closed before anyone could confirm that the updates actually solved this issue.

mike240se commented 4 years ago

i am in the same boat, I use PHPStorm to edit a symfony project and I was hosting the project in windows and accessing it in linux as microsoft suggested but that broke when i upgraded from symfony 3.4 to 4.4. In Symfony 4.4 it was throwing hundreds of cache errors every page load (slowing things down badly) because it was trying to set linux utime on the cache files and i guess windows doesnt support the same time resolution in its file system or something like that.

ElanHasson commented 4 years ago

@fracasula

Any ideas?

Yeah, use subst:

From cmd.exe: subst S: \\wsl$\Ubuntu\home\elan\source\repos

Now to goto your s: drive

image

abreingan commented 4 years ago

the subst above does not work for me (if the problem is "active" at the time - it just reports path not found. Very annoying as I have not had any other major problems

pfortin-expertime commented 4 years ago

Thanks a lot @ElanHasson , now I can work with PhpStorm on my WSL2 distro without using FTP connection!

Anasme commented 4 years ago

Thanks a lot @ElanHasson , now I can work with PhpStorm on my WSL2 distro without using FTP connection!

Hello ! I want to achieve the same goal as you, launching my project over wsl2 on phpstorm... I tried to subst like ElanHasson said my wsl2 home but cant explore it by explorer.. can you tell me how you did it please?

btw I access S: drive by cmd.

Im on windows 10 pro 19041

Anasme commented 4 years ago

Thanks a lot @ElanHasson , now I can work with PhpStorm on my WSL2 distro without using FTP connection!

Hello ! I want to achieve the same goal as you, launching my project over wsl2 on phpstorm... I tried to subst like ElanHasson said my wsl2 home but cant explore it by explorer.. can you tell me how you did it please?

btw I access S: drive by cmd.

Im on windows 10 pro 19041

Ok sorry for the post, found out I can map my \wsl$\debian only, If i try to go deeper in folder directory its fail.

Thanks again!

ElanHasson commented 4 years ago

Good to hear :)

Elan Hasson 561-445-4667

gottfired commented 4 years ago

Same here, tried all the solutions, nothing works. \wsl$\Ubuntu is unreachable. explorer.exe only works in windows mount points. WSL2 is basically unusable this way.

edditor commented 4 years ago

Same here, tried all the solutions, nothing works. \wsl$\Ubuntu is unreachable. explorer.exe only works in windows mount points. WSL2 is basically unusable this way.

Same for me. Windows 2004 build 19640.1 with Ubuntu-20.04

onomatopellan commented 4 years ago

@gottfired @edditor Open an elevated Powershell and post the output of these

reg query HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider /s

reg query HKLM\SYSTEM\CurrentControlSet\Services\p9np /s

reg query HKLM\SYSTEM\CurrentControlSet\Services\p9rdr /s

gottfired commented 4 years ago

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\HwOrder ProviderOrder REG_SZ P9NP,RDPNP,LanmanWorkstation,webclient

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order ProviderOrder REG_SZ P9NP,RDPNP,LanmanWorkstation,webclient

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\ProviderOrder LanmanWorkstation REG_DWORD 0x7d0 RDPNP REG_DWORD 0x3e8 webclient REG_DWORD 0xbb8 P9NP REG_DWORD 0x1f4

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p9np Description REG_EXPAND_SZ @%systemroot%\system32\p9np.dll,-101 DisplayName REG_EXPAND_SZ @%systemroot%\system32\p9np.dll,-100

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p9np\NetworkProvider DeviceName REG_SZ \Device\P9Rdr DisplayName REG_EXPAND_SZ @%systemroot%\system32\p9np.dll,-100 Name REG_SZ Plan 9 Network Provider ProviderPath REG_EXPAND_SZ %SystemRoot%\System32\p9np.dll TriggerStartCompleteNotification REG_BINARY 7510BCA3541EC641 TriggerStartNotification REG_BINARY 7508BCA3541EC641 TriggerStartPrefix REG_SZ wsl$

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\p9rdr DependOnService REG_MULTI_SZ RDBSS Description REG_SZ @%SystemRoot%\System32\drivers\p9rdr.sys,-101 DisplayName REG_SZ @%SystemRoot%\System32\drivers\p9rdr.sys,-100 ErrorControl REG_DWORD 0x1 ImagePath REG_EXPAND_SZ System32\drivers\p9rdr.sys Start REG_DWORD 0x3 Type REG_DWORD 0x1

onomatopellan commented 4 years ago

@gottfired No issue here in build 19041 with the same reg entries. Can you post the output of sudo dmesg in pastebin or a gist?

gottfired commented 4 years ago

https://gist.github.com/gottfired/0d5ea06d1c4d083da67e50a4570357c7

onomatopellan commented 4 years ago

@gottfired Thanks. I can't see anything wrong there. How about the output of sudo mount ?

gottfired commented 4 years ago

/dev/sdb on / type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered) tmpfs on /mnt/wsl type tmpfs (rw,relatime) tools on /init type 9p (ro,relatime,dirsync,aname=tools;fmask=022,loose,access=client,trans=fd,rfd=6,wfd=6) none on /dev type devtmpfs (rw,nosuid,relatime,size=6518436k,nr_inodes=1629609,mode=755) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime) proc on /proc type proc (rw,nosuid,nodev,noexec,noatime) devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620,ptmxmode=000) none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755) none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime) none on /run/shm type tmpfs (rw,nosuid,nodev,noatime) none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime) tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755) cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu) cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event) cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio) cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb) cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids) cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma) C:\ on /mnt/c type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8) D:\ on /mnt/d type 9p (rw,noatime,dirsync,aname=drvfs;path=D:\;uid=1000;gid=1000;symlinkroot=/mnt/,mmap,access=client,msize=65536,trans=fd,rfd=8,wfd=8)

onomatopellan commented 4 years ago

@gottfired This thread is closed. Better follow #5307. We are waiting for the team to answer there.

arthurborgesdev commented 4 years ago

I was having this issue today, but after updating the WSL kernel, it began working again!

https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

thisismydesign commented 4 years ago

For me the issue turned out to be that via Chocolatey WSL Ubuntu is installed to require admin rights (choco install wsl2 wsl-ubuntu-1804). This is also reflected in that the command line is only accessible when running as an admin. I tried running explorer as admin but that didn't help.

It was solved by:

Afterward: