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

External drive --mount in WSL2 yields "The system cannot find the file specified." #6910

Closed
1 of 2 tasks
maxboone opened this issue May 4, 2021 · 48 comments
Closed
1 of 2 tasks

Comments

@maxboone
Copy link

maxboone commented May 4, 2021

Windows Build Number

10.0.21370.1 (ARM64 / Surface Pro X)

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.4.72

Distro Version

No response

Other Software

No response

Repro Steps

C:\> wmic diskdrive list brief
Caption                             DeviceID            Model                               Partitions  Size
WDC WD64 00BEVT-22A0RT0 USB Device  \\.\PHYSICALDRIVE1  WDC WD64 00BEVT-22A0RT0 USB Device  3           640132416000
HFM512GDGTNG-87A0A                  \\.\PHYSICALDRIVE0  HFM512GDGTNG-87A0A                  3           512105932800
C:\>wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the file specified.

Expected Behavior

A mounted block device in WSL

Actual Behavior

WSL returns The system cannot find the file specified.

Diagnostic Logs

ETL-file captured logs: etl-file.zip

The specific error from the ETL-file seems Hyper-V related:

[
    {
        "ResourcePath": "VirtualMachine/Devices/Scsi/0/Attachments/2",
        "RequestType": "Add",
        "Settings": {
            "Type": "PassThru",
            "Path":"\\\\.\\PHYSICALDRIVE1"
            }
    },
    {
        "Error": -2147024894,
        "ErrorMessage": "The system cannot find the file specified.",
        "ErrorEvents": [
            {
                "Message": "'Virtual Machine': Attachment '\\\\?\\usbstor#disk&ven_wdc_wd64&prod_00bevt-22a0rt0&rev_#20151222&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}' could not be found due to error: 'The system cannot find the file specified.' (0x80070002). (Virtual machine ID A1BB5BC7-228E-4484-83F3-21AC60FADE15)",
                "Provider": "edacd782-2564-4497-ade6-7199377850f2",
                "EventId": 12240,
                "Flags": 5,
                "Data": [
                    {
                        "Type": "String",
                        "Value": "Virtual Machine"
                    },
                    {
                        "Type":"String",
                        "Value": "A1BB5BC7-228E-4484-83F3-21AC60FADE15"
                    },
                    {
                        "Type": "String",
                        "Value":"\\\\?\\usbstor#disk&ven_wdc_wd64&prod_00bevt-22a0rt0&rev_#20151222&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}"
                    },
                    {
                        "Type":"String",
                        "Value":"%%2147942402"
                    },
                    {
                        "Type":"String",
                        "Value":"0x80070002"
                    },
                    {
                        "Type":"String",
                        "Value":"Hyper-V Virtual Machine Management service"
                    },
                    {
                        "Type":"String",
                        "Value":""
                    }
                ]
            }
        ]
    }
]
@mahyar1284
Copy link

I have the same problem

@lbssousa
Copy link

lbssousa commented Nov 9, 2021

Me too

@AlfrFerr
Copy link

AlfrFerr commented Nov 14, 2021

Same problem here on my Surface Pro X (Windows 11 Pro 22000.318) also trying to mount a vhdx virtual disk:

PS C:\WINDOWS\system32> Write-Output "\\.\PhysicalDrive$((Mount-VHD -Path C:\Users\aferr\Documents\WSL\Ubuntu-20.04-kernel\ext4.vhdx -PassThru | Get-Disk).Number)"
\\.\PhysicalDrive1

PS C:\WINDOWS\system32> Get-WmiObject -query "SELECT * from Win32_DiskDrive"


Partitions : 0
DeviceID   : \\.\PHYSICALDRIVE1
Model      : Disco virtuale Microsoft
Size       : 274872407040
Caption    : Disco virtuale Microsoft

Partitions : 3
DeviceID   : \\.\PHYSICALDRIVE0
Model      : HFM256GDGTNG-87A0A
Size       : 256052966400
Caption    : HFM256GDGTNG-87A0A

S C:\WINDOWS\system32> wsl --mount \\.\PhysicalDrive1
Impossibile trovare il file specificato.

Is it an arm64 related issue?

@roshkins
Copy link

Using this alternative worked for me:
https://www.scivision.dev/mount-usb-drives-windows-subsystem-for-linux/

@AuditeMarlow
Copy link

I'm having the same issue. I'm not suspecting this to be an ARM64 specific problem as I'm currently experiencing this on an AMD64 machine.

PS C:\Windows\system32> GET-WMIOBJECT -query "SELECT * FROM Win32_DiskDrive"


Partitions : 3
DeviceID   : \\.\PHYSICALDRIVE0
Model      : THNSF5512GPUK TOSHIBA
Size       : 512105932800
Caption    : THNSF5512GPUK TOSHIBA

Partitions : 2
DeviceID   : \\.\PHYSICALDRIVE1
Model      : Generic- SD/MMC/MS PRO USB Device
Size       : 3939909120
Caption    : Generic- SD/MMC/MS PRO USB Device



PS C:\Windows\system32> wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.

@dmitry-ovon
Copy link

Same problem here...

Windows 10.0.22000
WSL2
5.10.60.1-microsoft-standard-WSL2

C:\Windows\system32> wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.

On top of command not working, it also "Ejects" the drive as a side effect.
Any solutions to this?

@nirvam
Copy link

nirvam commented Mar 23, 2022

Same problem here.
Surface Pro 7 Windows 11 22000.556

@dmitry-ovon You can bring back the drive using following command:
Set-Disk $n -IsOffline 0
Replace $n with your disk number

@timedroid
Copy link

I'm getting the same problem trying to mount an SD card over USB in Windows 11 22000.593

@delucca
Copy link

delucca commented Apr 15, 2022

Same thing here while trying to mount an USB disk with 2 partitions (one of them is Lukys encrypted) with ext4 filesystem

I'm on Windows 11 and my CPU has an x86 arch (so, it is not related to ARM)

@somadhy
Copy link

somadhy commented Apr 23, 2022

Hi all. Same error.

❯ [environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22000  0

❯ wsl --update
Checking for updates...
No updates are available.
Kernel version: 5.10.102.1
❯ GET-CimInstance -query "SELECT * from Win32_DiskDrive"

DeviceID           Caption                          Partitions Size          Model
--------           -------                          ---------- ----          -----
\\.\PHYSICALDRIVE5 Generic USB SD Reader USB Device 1          263044454400  Generic USB SD Reader USB Device
\\.\PHYSICALDRIVE6 Generic USB MS Reader USB Device 0                        Generic USB MS Reader USB Device
❯ wsl --mount \\.\PHYSICALDRIVE5
The system cannot find the drive specified.
❯ wsl --mount \\.\PHYSICALDRIVE5 --bare
The system cannot find the drive specified.

@rxbrad
Copy link

rxbrad commented May 24, 2022

Same issue here. The removable media (SD card in a USB reader) has a FAT32 partition and an EXT4 partition. It is unmountable on my AMD64 (Ryzen 5600X) machine. Additionally, the drive ejects in Win11 when I attempt the wsl --mount command.

> [environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22000  0

> wsl --update
Checking for updates...
No updates are available.
Kernel version: 5.10.102.1

> GET-CimInstance -query "SELECT * from Win32_DiskDrive"
DeviceID           Caption                      Partitions Size          Model
--------           -------                      ---------- ----          -----
\\.\PHYSICALDRIVE0 T-FORCE TM8FP7001T           3          1000202273280 T-FORCE TM8FP7001T
\\.\PHYSICALDRIVE1 SanDisk SDDR-B531 USB Device 2          32021015040   SanDisk SDDR-B531 USB Device

> wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.

@yuhcaesar
Copy link

Same problem here.

Same issue here. The removable media (SD card in a USB reader) has a FAT32 partition and an EXT4 partition. It is unmountable on my AMD64 (Ryzen 5600X) machine. Additionally, the drive ejects in Win11 when I attempt the wsl --mount command.

> [environment]::OSVersion.Version
Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22000  0

> wsl --update
Checking for updates...
No updates are available.
Kernel version: 5.10.102.1

> GET-CimInstance -query "SELECT * from Win32_DiskDrive"
DeviceID           Caption                      Partitions Size          Model
--------           -------                      ---------- ----          -----
\\.\PHYSICALDRIVE0 T-FORCE TM8FP7001T           3          1000202273280 T-FORCE TM8FP7001T
\\.\PHYSICALDRIVE1 SanDisk SDDR-B531 USB Device 2          32021015040   SanDisk SDDR-B531 USB Device

> wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.

@itpropro
Copy link

This issue is already over a year old, any updates @craigloewen-msft ?

@craigloewen-msft
Copy link
Member

Tagging @OneBlue here for visibility!

@ahmedsabriz
Copy link

ahmedsabriz commented Jul 24, 2022

I am having the same problem on W11 22622.436
I can mount a device from WSL2 Ubuntu using sudo mount -t drvfs d: /mnt/d. However, I can't find the block file.

@orpheustaken
Copy link

orpheustaken commented Jul 25, 2022

Same problem on Win11 (21H2 22000.832), and ArchWSL.

Administrator in C:\Arch
❯ Get-CimInstance -ClassName Win32_Processor | Select-Object -ExcludeProperty "CIM*"

DeviceID Name                                            Caption                             MaxClockSpeed SocketDesignation Manufacturer
-------- ----                                            -------                             ------------- ----------------- ------------
CPU0     AMD Ryzen 3 3200U with Radeon Vega Mobile Gfx   AMD64 Family 23 Model 24 Stepping 1 2600          FP5               AuthenticAMD



Administrator in C:\Arch
❯ GET-CimInstance -query "SELECT * from Win32_DiskDrive"

DeviceID           Caption                       Partitions Size         Model
--------           -------                       ---------- ----         -----
\\.\PHYSICALDRIVE0 ADATA SX6000LNP               3          256052966400 ADATA SX6000LNP
\\.\PHYSICALDRIVE1 Kingston DT 101 II USB Device 1          8027873280   Kingston DT 101 II USB Device



Administrator in C:\Arch
❯ wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.

Administrator in C:\Arch
❯ wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.

@Amondale
Copy link

Amondale commented Aug 15, 2022

In my case, a SDXC card in a reader will neither mount in WSL2 via --mount nor using the /etc/fstab route:

sudo mount -t drvfs E: /mnt/sd <4>WARNING: mount: waiting for virtio device... <3>init: (639) ERROR: MountPlan9WithRetry:285: mount drvfs on /mnt/sd (cache=mmap,rw,msize=262144,trans=virtio,aname=drvfs;path=E:;symlinkroot=/mnt/) failed: 2 mount: No such file or directory

It is formatted NTFS, normally not a problem to refer to it as /mnt/e. Linux (dual booted) sees this partition as /dev/mmcblk0p1 and mounts it fine. WSL seems crankier about it ...

Here's the output from dmesg, not helpful to me at least:

[ 5.835977] init: (1) ERROR: UtilCreateProcessAndWait:673: /bin/mount failed with status 0x [ 5.835980] 4000 [ 5.835989] init: (1) ERROR: ConfigMountFsTab:2529: Processing fstab with mount -a failed.

Possible (bad) interaction with Antivirus in Windows? Seems that way to me.

@frankiee12a9
Copy link

same problem for me after the updates on 12th January. Still looking for a resolution to it.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 13, 2023

/logs

@ghost
Copy link

ghost commented Jan 13, 2023

Hello! Could you please provide more logs to help us better diagnose your issue?

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

Thank you!

@frankiee12a9
Copy link

There are some problems with the Docker desktop that uses WSL 2 backend as the based engine. I do some workaround such remove the linux distro and WSL 2 I'm using and reinstalled it again. However, in the distribution installation step, I got:

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070002
Error: 0x80070002 The system cannot find the file specified.
Press any key to continue...

I've spent several hours tried to troubleshoot it but still stuck on it.

@ghost ghost closed this as completed Jan 21, 2023
@ghost
Copy link

ghost commented Jan 21, 2023

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

@jramsey123
Copy link

Why was this issue closed? It's still a problem. I can't mount/access an SD Card with wsl. Logs attached.

WslLogs-2023-02-14_16-52-38.zip

@dmacgowan-acog
Copy link

This continues to be a problem.
(Posting to keep issue open.)

@pki791
Copy link

pki791 commented Feb 28, 2023

Have the same problem, i always make an image from the drive, then mount the image as loop, after work i flash the image back to the drive. Will this be ever solved?????

@maxboone
Copy link
Author

maxboone commented Feb 28, 2023

Why was this issue closed? It's still a problem. I can't mount/access an SD Card with wsl. Logs attached.

Seems to be closed because I didn't reopen it or reply with logs (which I thought I provided in the OP, but seemingly didn't). I'll dust off my Pro X and collect some logs tomorrow and reopen the issue.

@bretthacker
Copy link

This exact issue has been reported in various places for over 2 years. It's clear most of these folks are dealing with a Raspberry Pi (SD card, 2 partitions, fat32 and ext4). It's ludicrous that someone in Redmond hasn't taken the 10 minutes necessary to repro this issue then step their code to see what's broken. Of course, fixing it would enable all these people to successfully and easily use a different device with a different OS, so after 40 years, Microsoft is still...Microsoft.

@redBlueberry
Copy link

Yes, exact same issue here. Raspberry Pi SD card and The system cannot find the drive specified.

@flama90
Copy link

flama90 commented Apr 5, 2023

Yes, exact same issue here. Raspberry Pi SD card and The system cannot find the drive specified.

I have exactly the same problem

@SajinPrince
Copy link

I have the same issue using AM5 platform Windows 11. It works on my Intel gigabyte laptop Windows 11.
Even when I insert the stick into my notebook it picks up the partition natively in Windows.
image

@adamjames
Copy link

Posting to reopen this, happens for me too. Surprised there's not an automated test in place to check this functionality given how new WSL2 is. The Microsoft Learn Article documenting this was updated March 20th.

@mgzfcam
Copy link

mgzfcam commented May 22, 2023

Hi all. I have the same problem and still did not find out how to actually solve it, as far as the built-in SD card reader of my laptop is concerned. However, I found a workaround with an external USB SD Card reader and this awesome video:
https://www.youtube.com/watch?v=iyBfQXmyH4o

@o-alquimista
Copy link

Unfortunately, this is currently unsupported. From https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk:

If you are looking for guidance on how to connect a USB device (flash drive, SD card reader, etc), see Connect USB devices.

Which indicates the use of a third-party open source utility called usbipd-win.

@jglathe
Copy link

jglathe commented Jun 9, 2023

Which indicates the use of a third-party open source utility called usbipd-win.

nice

@maxboone
Copy link
Author

Unfortunately, this is currently unsupported. From https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

That explains, cool, and thanks for the usbipd-win link - good stuff!

@o-alquimista
Copy link

I'm using it here to decrypt a LUKS-encrypted USB stick. It works good. The only downside is having to compile the WSL kernel with USB storage support.

@ruff-huettinger
Copy link

I'm having the same issue: Want to write an image file with Win32 Disk Imager under Win11 from a Raspi SD card, but only the NTFS partition shows up, not the ext4 one. Used to work under Win10
Screenshot 2024-03-12 112110
.

@wptaylor
Copy link

wptaylor commented May 9, 2024

Same issue, disappointing it hasn't been fixed in three years.

image

@pinballelectronica
Copy link

pinballelectronica commented May 15, 2024

Haha the internet is packed full of people complaining about this. It's actually hilarious it's taken years. I wonder if Microsoft is doing an experiment to see how long people will keep trying when they won't fix the solution to their bugs. The answers website is spammed with these questions too. In concept it seems fairly trivial to fix this- what would cause an ext4 mount failure? I know Windows generally needs a running driver to access ext* filesystems so I presume the solution must be in a driver somewhere. It's definitely not trivial to translate a filesystem although mounting, I think, shouldn't be too hard. I wonder if it's a problem with the partitions? Has anyone succesfully mounted an EXT* filesystem via USB with ONE partition? Just curious..
Good luck all, it's like watching paint dry.

@Apfelmoes
Copy link

How the fuck has this still not been fixed?

@pki791
Copy link

pki791 commented Jul 5, 2024

i overcome it by making image if the drive i want to modify (HddRawCopy), mount it in loop in WSL/Ubuntu, modify, unmount, reimage. What a pain in the ass. Trying to leave windows now, going to macOS or ubuntu.

@jglathe
Copy link

jglathe commented Jul 5, 2024

yk how I overcame this? I used Linux bare metal 🤷‍♂️ In my case I used a RPi4 to create the image I wanted to create from WSL first. It has the same arch, was able to do my stuff. Still baffled that this isn't solved. Maybe its an architectural issue with WSL2 VMs.

@lmoesch
Copy link

lmoesch commented Jul 24, 2024

This is still an issue and not "closed" - Same problem here.

@maxboone
Copy link
Author

This is still an issue and not "closed" - Same problem here.

Create a new one and tag this, I can't reopen it afaics

@pinballelectronica
Copy link

pinballelectronica commented Aug 19, 2024

i overcome it by making image if the drive i want to modify (HddRawCopy), mount it in loop in WSL/Ubuntu, modify, unmount, reimage. What a pain in the ass. Trying to leave windows now, going to macOS or ubuntu.

that's hacky as fu*ck but it's clever.

@yhaiovyi
Copy link

yhaiovyi commented Sep 5, 2024

Why on Earth was it closed?

@NilsRo
Copy link

NilsRo commented Sep 16, 2024

Same problem with RPi image....damn, why its closed...

@DanilSapronov
Copy link

Same problem with USRP N300 SD-card. Now I need to search normal Ubuntu laptop to flash it.

This issue was closed.
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