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

Running wsl2 on non-admin user is not mounting drive C #11135

Closed
1 of 2 tasks
ciprianglg opened this issue Feb 8, 2024 · 9 comments
Closed
1 of 2 tasks

Running wsl2 on non-admin user is not mounting drive C #11135

ciprianglg opened this issue Feb 8, 2024 · 9 comments

Comments

@ciprianglg
Copy link

ciprianglg commented Feb 8, 2024

Windows Version

Microsoft Windows [Version 10.0.22631.3007]

WSL Version

WSL version: 2.1.1.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Kernel version: 5.15.146.1-2

Distro Version

Debian 12

Other Software

No response

Repro Steps

Install wsl --install -d Debian running with user1 as admin
Let the install to finish and create initial user in linux distro
Remove admin rights for user1
Reboot windows
Open from windows terminal a Debian shell, and you will will see that drive c: is not mapped and then because of this you will get :

<3>WSL (307) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS
<3>WSL (307) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\system32
<3>WSL (307) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\Wbem
<3>WSL (307) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\WindowsPowerShell\v1.0\

which is normal behavior from my POV since drive C was not mounted in the first place.

Trying to mount c: drive:
sudo mount -t drvfs C: /mnt/c/
you will get:
<3>WSL (438) ERROR: UtilConnectVsock:586: connect port 50002 failed 110

Expected Behavior

When you open Debian shell, to be able to run it as normal user and not as elevated user.

Actual Behavior

At the moment running as non admin user gives an error because drive c: is not mounted.
This problem is not present in version https://github.com/microsoft/WSL/releases/tag/1.2.5

Diagnostic Logs

No response

Copy link

github-actions bot commented Feb 8, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@ciprianglg ciprianglg changed the title Running wsl on non-admin user is not mounting drive C Running wsl2 on non-admin user is not mounting drive C Feb 8, 2024
@ciprianglg
Copy link
Author

I tried to replicate this on some Azure vm's and i was not able. Somehow i noticed that this is randomly happening. If i use the combination of wsl --shutdown or wsl --terminate, then will start working for regular user. Don't know how to debug this, as i can't find something usefully in dmesg about why it is not mounting, except the following error which is about the paths:

[ 1.967289] Exception: Invalid argument @../main.cpp:117 (TranslateWindowsPath)

@OneBlue
Copy link
Collaborator

OneBlue commented Feb 13, 2024

/logs

@ciprianglg
Copy link
Author

I've sent the logs to the email address.

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 13, 2024

Thank you @ciprianglg.

Looking at the logs, this seem to be the root cause of the drives not being mounted:

86	True	Microsoft.Windows.Lxss.Manager	VerboseLog	0	02-14-2024 00:39:20.770	"	"	"code: 	
failurecount: 	7
file: 	D:\a\1\s\src\windows\wslcore\lib\WslCoreVm.cpp
function: 	
hr: 	0x80080005
linenumber: 	2941
message: 	""D:\a\1\s\packages\Microsoft.Windows.ImplementationLibrary.1.0.240102.2\include\wil\result_macros.h(7244)\wslservice.exe!00007FF7DA2FCD4B: (caller: 00007FF7DA3857DE) Exception(5) tid(269c) 80080005 Server execution failed  ""
threadid: 	9884
wslVersion: 	2.1.1.0"	D:\a\1\s\src\windows\wslcore\lib\WslCoreVm.cpp			7832	9884	5		7888b357-43c2-42c8-9ff8-562cb05f9e79	

This most likely means that the dllhost.exe process running this is crashing.

Can you follow the '11) Reporting a WSL process crash' section and reproduce the issue to collect the process crash and share it with us ?

@ciprianglg
Copy link
Author

ciprianglg commented Mar 21, 2024

@OneBlue i was off for a couple of days, so unable to reply. I tried to take a dump with the script using admin rights but:

 ~  .\collect-wsl-logs.ps1 -Dump
Log collection is running. Please reproduce the problem and once done press any key to save the logs.
Saving logs...
100%  [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:123
Line |
 123 |      $DumpMethod = $Assembly.GetNestedType('NativeMethods', 'NonPublic …
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

    Directory: C:\Users\......\WslLogs-2024-03-21_07-50-57

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           3/21/2024  7:51 AM                dumps
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.4696.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.4696.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.7484.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.7484.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.26696.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wsl.26696.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.13044.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.13044.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.25988.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.25988.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.39004.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslhost.39004.dmp
Writing C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslservice.10052.dmp
InvalidOperation: C:\Users\......\collect-wsl-logs.ps1:136
Line |
 136 |          $Result = $DumpMethod.Invoke($null, @($process.Handle,
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.
Failed to write dump for: C:\Users\......\WslLogs-2024-03-21_07-50-57\dumps/wslservice.10052.dmp

@OneBlue
Copy link
Collaborator

OneBlue commented Mar 21, 2024

You don't need to capture the dumps yourself. This section '11) Reporting a WSL process crash' shows how can enable automatic crash dump collection

@ciprianglg
Copy link
Author

@OneBlue i've replicated the issue several time, but no crash was generated, so maybe there is no crash. The only workaround is to use wsl --terminate command, and after i start again all is fine, and c drive is mounted.
Step1: Computer is booted up
Step2: Open a terminal and start a shell with Debian (here i get the error since drive c: is not mounted)
Step3: I use wsl --terminat Debian
Step4: I open another shell with Debian and this is fine, and all is working.

I have other colleagues with the same issue, and all of them are able to use the steps i've mentioned, and behavior is the same.
My only option is to revert wsl to 1.2.5 where the problem is not present, or use the steps i've mentioned.

@Connor-McCarron
Copy link

Had similar issue. In my case the docker-desktop image was my default linux instance for wsl after an update WSL cannot mount drive and path variables to the docker distro ensure default distro is Debian in your case

wsl --setdefault {DISTRO}
image

image

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

No branches or pull requests

3 participants