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

18362.53 Accessing 9P \\wsl$\xxx path sometimes fails #3995

Closed
jonitis opened this issue Apr 24, 2019 · 6 comments
Closed

18362.53 Accessing 9P \\wsl$\xxx path sometimes fails #3995

jonitis opened this issue Apr 24, 2019 · 6 comments

Comments

@jonitis
Copy link

jonitis commented Apr 24, 2019

Please fill out the below information:
10.0.18362.53, Surface 8Gb RAM

In PowerShell 6.2 and 5.1 mix these commands in random order:

PS C:\Users\Daini> history

  Id CommandLine
  -- -----------
   1 dir \\wsl$\Ubuntu
   2 dir \\wsl$\Ubuntu\home
   3 dir \\wsl$\
   4 dir \\wsl$\
   5 dir \\wsl$\
   6 dir \\wsl$\ubuntu
   7 dir \\wsl$\Ubuntu
   8 dir \\wsl$\Ubuntu\
   9 dir \\wsl$\ubuntu
  10 dir \\wsl$\Ubuntu
  11 dir \\wsl$\Ubuntu

It is expected that "\\wsl$\" returns error "dir : Cannot find path '\\wsl$\' because it does not exist." (unlike Explorer which displays distro name), but correct name with uppercase Ubuntu returns list of files. Mixing complete name with incomplete many times in a row, changing capitalization for Ubuntu etc. finally will get you in state that correct path that worked before will return error. Also from other powershell window or explorer window. Then after some time it recovers.

  • What's wrong / what should be happening instead:
    Valid path like " \\wsl$\Ubuntu\home\dainis" will report that it does not exist. After some time work again.
PS C:\Users\Daini> dir \\wsl$\Ubuntu
dir : Cannot find path '\\wsl$\Ubuntu' because it does not exist.
At line:1 char:1
+ dir \\wsl$\Ubuntu
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (\\wsl$\Ubuntu:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini> dir \\wsl$\Ubuntu


    Directory: \\wsl$\Ubuntu

Not sure whether PowerShell is somehow involved that it may cache already once resolved valid names, but I can still recreate the problem by alternating "dir \\wsl$\", "dir \\wsl$\Ubuntu", "dir \\wsl$\Ubuntu\home\dainis" in command prompt and Explorer address bar. Even after reboot.
If same command fails in one window it may work from other PS windows and it recovers problem for first window, too. I am not running the same request in parallel from two windows - strictly sequentially.
Could it be that 9P server fails and then automatically recovers?

PS C:\Users\Daini> dir \\wsl$\
dir : Cannot find path '\\wsl$\' because it does not exist.
At line:1 char:1
+ dir \\wsl$\
+ ~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\wsl$\:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini> dir \\wsl$\ubuntu\
dir : Cannot find path '\\wsl$\ubuntu\' because it does not exist.
At line:1 char:1
+ dir \\wsl$\ubuntu\
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\wsl$\ubuntu\:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini> dir \\wsl$\ubuntu
dir : Cannot find path '\\wsl$\ubuntu' because it does not exist.
At line:1 char:1
+ dir \\wsl$\ubuntu
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\wsl$\ubuntu:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini> dir \\wsl$\Ubuntu\home\dainis


    Directory: \\wsl$\Ubuntu\home\dainis

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        31.03.2018    21:02                .cache
d-----        31.03.2018    21:02                .config
d-----        31.03.2018    21:02                .local
d-----        24.01.2019    21:18                .ssh
------        24.04.2019    20:40            218 .bash_history
------        14.10.2017    14:20            220 .bash_logout
------        14.10.2017    14:20           3771 .bashrc
------        14.10.2017    14:20            655 .profile
------        14.10.2017    14:37              0 .sudo_as_admin_successful
------        16.03.2019    16:17            985 .viminfo

PS C:\Users\Daini> dir \\wsl$\Ubuntu\home\dainis
dir : Cannot find path '\\wsl$\Ubuntu\home\dainis' because it does not exist.
At line:1 char:1
+ dir \\wsl$\Ubuntu\home\dainis
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\wsl$\Ubuntu\home\dainis:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini> dir \\wsl$\Ubuntu\home\dainis


    Directory: \\wsl$\Ubuntu\home\dainis

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        31.03.2018    21:02                .cache
@jonitis
Copy link
Author

jonitis commented Apr 24, 2019

Same problem can be recreated with cmd.exe. So .NET code not involved in PowerShell. Easy to get error about invalid address in Explorer address bar typing "\\wsl$\ubuntu" (note lowercase and no trailing '\'). Explorer displays error "\\wsl$\ubuntu" is not accessible. But once you enter it with capitalized Ubuntu it displays files and also accepts lowercase initial value (cached?)

@jonitis
Copy link
Author

jonitis commented Apr 24, 2019

Microsoft Windows [Version 10.0.18362.53]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\Daini>dir \\wsl$\ubuntu
The network name cannot be found.

C:\Users\Daini>dir \\wsl$\ubuntu
The network name cannot be found.

C:\Users\Daini>dir \\wsl$\ubuntu
The network name cannot be found.

C:\Users\Daini>dir \\wsl$\ubuntu
The network name cannot be found.

C:\Users\Daini>dir \\wsl$\ubuntu\home
The network name cannot be found.

C:\Users\Daini>dir \\wsl$\ubuntu\home
 Volume in drive \\wsl$\ubuntu has no label.
 Volume Serial Number is 0000-0000

 Directory of \\wsl$\ubuntu\home

14.10.2017  14:20    <DIR>          .
14.10.2017  14:20    <DIR>          ..
16.03.2019  17:26    <DIR>          dainis
               0 File(s)              0 bytes

Started to work when in second window requested longer network path that was not yet resolved in current session "dir \\wsl$\Ubuntu\home\dainis\.ssh". Very fragile/unreliable :(

@therealkenc
Copy link
Collaborator

therealkenc commented Apr 24, 2019

Was able to reproduce with Powershell. Seems to be limited to getting the case of the distribution wrong. Contrast the rest of the WSL tree (say ...\Ubuntu\HoMe or ...\Ubuntu\tMp) which will consistently (and correctly) fail on path nonexistence.

Don't read too much into what File Explorer is doing, since it does its own internal caching of paths for its own purposes, and does its own case insensitive comparisons on those paths. None of that is WSL actionable.

Work around appears to be to not get the disto case wrong.

@jonitis
Copy link
Author

jonitis commented May 25, 2019

PS C:\Users\Daini> dir \\wsl$\ubuntu
dir : Cannot find path '\\wsl$\ubuntu' because it does not exist.
At line:1 char:1
+ dir \\wsl$\ubuntu
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\wsl$\ubuntu:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

PS C:\Users\Daini>

PS C:\Users\Daini> dir $env:windir\system32\p9np.dll

    Directory: C:\WINDOWS\system32

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a---l        07.05.2019    20:10         101688 p9np.dll

PS C:\Users\Daini> reg query HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider /s

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

PS C:\Users\Daini> reg query HKLM\SYSTEM\CurrentControlSet\Services\p9np /s

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

PS C:\Users\Daini> reg query HKLM\SYSTEM\CurrentControlSet\Services\p9rdr /s

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

Started to work when followed by correct-case longer path:

  12 dir \\wsl$\ubuntu   # fails
  13 dir \\wsl$\Ubuntu\home\dainis\  # works
  14 dir \\wsl$\ubuntu  #works

@jonitis
Copy link
Author

jonitis commented May 25, 2019

This was 18362.145

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

3 participants