Repository navigation
Description
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
Activity
jonitis commentedon 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 commentedon Apr 24, 2019
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 commentedon 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\HoMeor...\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 commentedon May 25, 2019
Started to work when followed by correct-case longer path:
jonitis commentedon May 25, 2019
This was 18362.145
microsoft-github-policy-service commentedon Feb 1, 2024
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!