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

wsl --unmount cannot unmount paths with whitespaces #11451

Closed
1 of 2 tasks
andrea-reale opened this issue Apr 11, 2024 · 5 comments
Closed
1 of 2 tasks

wsl --unmount cannot unmount paths with whitespaces #11451

andrea-reale opened this issue Apr 11, 2024 · 5 comments
Assignees
Labels
emailed-logs Logs have been emailed

Comments

@andrea-reale
Copy link

andrea-reale commented Apr 11, 2024

Windows Version

Microsoft Windows [Version 10.0.22621.3155]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

No response

Other Software

No response

Repro Steps

Invoke wsl --unmount <PATH> where PATH is the path to a vhdx file with one or more spaces.

It does not mattter if: a) the path exists or not b) the vhdx file is mounted or not in wsl

Expected Behavior

Let's focus on the simplest case - the case where the vhdx file does not even exist.

Expected:

# Without spaces
> wsl --unmount 'mydisk.vhdx'
The system cannot find the file specified.
Error code: Wsl/Service/DetachDisk/ERROR_FILE_NOT_FOUND

# With spaces
> wsl --unmount 'my disk.vhdx'
The system cannot find the file specified.
Error code: Wsl/Service/DetachDisk/ERROR_FILE_NOT_FOUND

Actual Behavior

(On Powershell 7.4.1)

Actual:

# Without spaces
> wsl --unmount 'mydisk.vhdx'
The system cannot find the file specified.
Error code: Wsl/Service/DetachDisk/ERROR_FILE_NOT_FOUND

# With spaces
> wsl --unmount 'my disk.vhdx'
The filename, directory name, or volume label syntax is incorrect.
Error code: Wsl/0x8007007b

Note that I am focusing on the case of a disk that does not exist because it is the simplest to reproduce.

The real impact of this bug is that disks that have a space in their path or name cannot be unmounted. On the contrary, wsl --mount --vhd works as expected on paths with spaces.

Diagnostic Logs

No response

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Closed similar issues:

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

@andrea-reale andrea-reale changed the title whitespace in path not correctly handled by wsl --unmount wsl --unmount cannot unmount paths with whitespaces Apr 11, 2024
@andrea-reale
Copy link
Author

/emailed-logs

Copy link

Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'

@zcobol
Copy link

zcobol commented Apr 11, 2024

wsl --unmount will unmount (all drives) successfully:

PS E:\> wsl --mount --name mydrive --vhd '\\?\E:\test\my drive1.vhd' --bare
The operation completed successfully.
PS E:\> wsl.exe --unmount '\\?\E:\test\my drive1.vhd'
The filename, directory name, or volume label syntax is incorrect.
Error code: Wsl/0x8007007b
PS E:\> wsl.exe --unmount
The operation completed successfully.

What's noticeable is that mount works, no complain because of space in the path:

[Thu Apr 11 10:19:59 2024] sd 0:0:0:3: [sdd] Synchronizing SCSI cache
[Thu Apr 11 10:20:16 2024] scsi 0:0:0:3: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: Attached scsi generic sg3 type 0
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: [sdd] 4194304 512-byte logical blocks: (2.15 GB/2.00 GiB)
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: [sdd] Write Protect is off
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: [sdd] Mode Sense: 0f 00 00 00
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[Thu Apr 11 10:20:16 2024] sd 0:0:0:3: [sdd] Attached SCSI disk
[Thu Apr 11 10:20:32 2024] sd 0:0:0:3: [sdd] Synchronizing SCSI cache
[Thu Apr 11 10:20:39 2024] mini_init (132): drop_caches: 1 

@OneBlue OneBlue self-assigned this Apr 11, 2024
@benhillis
Copy link
Member

Fixed with https://github.com/microsoft/WSL/releases/tag/2.2.3.

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

No branches or pull requests

4 participants