microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.32k stars 814 forks source link

--mount support for USB flash drives #6011

Open HoFamilyMaker opened 4 years ago

HoFamilyMaker commented 4 years ago

upgrade to build 20226 run this command wsl --mount receive the error 'The remote procedure call failed'

image

Originally posted by @HoFamilyMaker in https://github.com/microsoft/WSL/issues/6008#issuecomment-702081473

OneBlue commented 4 years ago

Hi @HoFamilyMaker, Thanks for reporting this.

This issue has already been identified and will be fixed in an upcoming insider build.

Out of curiosity, what kind of disk are you trying to mount ?

markwill890 commented 4 years ago

Is this related to being able to access a WSL folder of the form...

\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data

with "Attempt to access invalid address" (this has been my Quick Access list in Explorer so I now it WAS the right folder).

Curiously, if I drill down to this folder in Explorer I can see the folder but it is now empty.

I have been using this for months, to edit in VS.Code. As of today, though, that folder is empty and I can no longer access the WordPress plugin I have been developing, since I can't access from VS.Code.

Strangely, though, the web site that is supposedly running from their (localhost) remains available. I'm really confused so any help would be really appreciated.

HoFamilyMaker commented 4 years ago

Hi @HoFamilyMaker, Thanks for reporting this.

This issue has already been identified and will be fixed in an upcoming insider build.

Out of curiosity, what kind of disk are you trying to mount ?

Thanks

I found this https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

Limitations USB flash drives are not supported at this time and will fail to attach to WSL 2. USB disks are supported though.

my disk is USB flash change to USB disks (SSD) run wsl --mount is OK

image

image

HoFamilyMaker commented 4 years ago

@HoFamilyMaker can you please update to the latest Insider build and try again to see if your problem is resolved?

You'll want to be on preview build 20226 or higher.

Thanks

My windows 10 is latest Insider build 20226 image

I found this

Limitations USB flash drives are not supported at this time and will fail to attach to WSL 2. USB disks are supported though.

try wsl2 to mount USB flash receive the error 'The remote procedure call failed' mount extend USB disk is OK

craigloewen-msft commented 4 years ago

My apologies @HoFamilyMaker I realize that the fix is not yet in Insiders, but thank you for updating! As @OneBlue mentioned we have a fix incoming for this soon, we'll ping this thread when it's available in the latest Insider build.

Imperatorn commented 3 years ago

Need this so much!

Can't do wsl --mount \.\PhysicalDrive1 :(

mengesb commented 3 years ago

I too am affected by this issue. Would really like to manipulate my linux partitions without additional software like Paragon. native support would be excellent.

Guessing this goes for the following as well:

PS C:\Windows\System32> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
INTEL SSDSC2BA400G4           \\.\PHYSICALDRIVE0  INTEL SSDSC2BA400G4           4           400085844480
SanDisk Ultra Fit USB Device  \\.\PHYSICALDRIVE1  SanDisk Ultra Fit USB Device  3           15373048320

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

I tried also with my SD card device, but that's definitely flash memory.

BakedCrossiant commented 3 years ago

Any update?

craigloewen-msft commented 3 years ago

Hey folks, wanting to add some clarity here since I realize that my last comment was not very clear. We added a fix for the 'remote procedure call failed' which was the immediate blocker for this in the root issue. However WSL --mount does not yet have support for USB flash drives formatted in Linux file formats. If you'd like to mount a flash drive in WSL you can do that if it's seen in Windows (in other words, if it's formatted in a file format that Windows understands like NTFS) using sudo mount -t drvfs f: /mnt/usbDrive if you have a USB flash drive as F: on windows. As of right now we do not have support for USB flash drives formatted in other file formats that Windows can't understand. In the future we'll be investigating adding support for flash drives to wsl --mount as a feature request for future iterations, but this is currently a backlog request.

kb3mkd commented 3 years ago

The reason I want wsl to work is so I can work on Raspberry pi drives from my Windows PC or laptop.

Imperatorn commented 3 years ago

I want this so I can dd

laszewsk commented 3 years ago

It would be great to get more clarification on this if It now works or not. I am confused if it works or not.

Use case why we like this feature:

A bunch of us seem to want to get access to the Raspberry PI sdcards so we can manipulate them. Originally we wanted to use wsl2 (the development version but the person working on this failed o get it working). Thus we developed an alternative in for gitbash at https://github.com/cloudmesh/cloudmesh-pi-burn in the branch https://github.com/cloudmesh/cloudmesh-pi-burn/tree/windows This is so we can in the meanwhile access the boot partition in windows directly. For this we developed a Diskpart class and it works reasonably well (not everything is yet working. we have not done the write part yet). HOwever if we were to have this in wsl2 we could do something like https://cloudmesh.github.io/pi/tutorial/raspberry-burn/ directly in wsl2. Right now we use gitbash.

I think many of us using the Pi for education would really appreciate a clarification about the status of this. Thanks

craigloewen-msft commented 3 years ago

@laszewsk as of right now --mount does not support USB flash drives if they are formatted in a Linux file format. This issue is left open to track this request. Please see this comment for full details: https://github.com/microsoft/WSL/issues/6011#issuecomment-801486712

Bluscream commented 2 years ago

Can someone tell me how to do this please? I need to fsck my raspi card

laszewsk commented 2 years ago

you could do a boot from a live linux CD and then use fsck from that.

In case you like to burn multiple SD Cards for a PI cluster, we updated our documentation at

Bluscream commented 2 years ago

you could do a boot from a live linux CD and then use fsck from that.

In case you like to burn multiple SD Cards for a PI cluster, we updated our documentation at

Thanks, i've tried that but it was unable to fix my card through Parted and commandline

blockfeed commented 2 years ago

+1, this feature is critical for anyone doing embedded development (and relies on transfers from SD cards via USB adapter).

luizoti commented 2 years ago

Same thing here, when using an sd card with adapter.

+1, this feature is critical for anyone doing embedded development (and relies on transfers from SD cards via USB adapter).

AlexeiScherbakov commented 2 years ago

Workaround is use Usb Reader (notebook integrated not allways works) + VMWare with Debian and GParted You can install VMWare Player, becase it now works with WLS2, but without hardware accelleration

Eugene-Lam commented 2 years ago

Same here, not working using USB reader


DeviceID           Caption                          Partitions Size          Model
--------           -------                          ---------- ----          -----
\\.\PHYSICALDRIVE0 Samsung SSD 970 EVO Plus 1TB     3          1000202273280 Samsung SSD 970 EVO Plus 1TB
\\.\PHYSICALDRIVE2 Lexar SD  WorkflowUR2 USB Device 2          15924142080   Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE3 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE1 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE2
The system cannot find the drive specified.

laptop buildin sd card slot not working too

PS C:\Users\Eugene> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
Samsung SSD 970 EVO Plus 1TB  \\.\PHYSICALDRIVE0  Samsung SSD 970 EVO Plus 1TB  3           1000202273280
PciE SDHC-Card                \\.\PHYSICALDRIVE1  PciE SDHC-Card                2           15924142080

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.
josh-hetland commented 2 years ago

+1 on the desire to interact with my Pi SD card from windows

laszewsk commented 2 years ago

We just released a new version of cloudmesh-pi-burn: https://cloudmesh.github.io/pi/tutorial/raspberry-burn-windows/ Although we use it for clusters, it can be used to burn a single card. However, the full potential is provided when you burn a cluster directly on the SD Cards, plug them in, switch the pis on and you have a readily configured cluster in your network. It does not burn in WSL2, BUT it burns on Windows, macOS, and Ubuntu. We use this regularly. Just in case you need a SLURM cluster, we just added documentation on how to do that here https://github.com/cloudmesh/cloudmesh-slurm#readme. We welcome contributions and improvements. We have used this code over the last 2 years and improved upon so it works now with the 64 bit OS.

uberDoward commented 2 years ago

Also expressing desire to include flash support via USB to mount in WSL!

sambartle commented 2 years ago

This ideally needs to be supported.. but if not then the documentation here: on microsoft.com needs updating to make it clearer this doesn't work for USB drives, it reads like you can connect a usb drive to linux as a drive using the link, or you can mount it like you can a HDD using powershell, which this issue makes clear you cannot.

The-MAZZTer commented 2 years ago

It sounds like this is a limitation of Hyper-V as USB Passthrough does not work on removable USB devices as well (I was going to try this on an Ubuntu VM as a workaround).

I tried to install XRDP so I could use Enhanced Session for my Ubuntu VM as it sounded like that could get me USB passthrough through RDP, but it seems like the protocol version XRDP{ uses is too old.

One workaround is that ViruaulBox can do USB passthrough with removable USB drives, so running a Linux VM you can mount and use the drive from there, using VirtualBox Guest Services to access host drives if needed to transfer data both ways. The main problem is VirtualBox tends to have a lot of problems when Hyper-V or the Hypervisor is enabled (which is is by default on Windows Professional), making it very annoying if you regularly make use of Hyper-V backed features such as WSL or WSA. But it can be used if you don't mind disabling ALL Hyper-V features in Windows Features, the hypervisor using bcdedit, and rebooting, and turning them back on and rebooting again when you need them.

yuhcaesar commented 2 years ago

Same here, not working using USB reader

DeviceID           Caption                          Partitions Size          Model
--------           -------                          ---------- ----          -----
\\.\PHYSICALDRIVE0 Samsung SSD 970 EVO Plus 1TB     3          1000202273280 Samsung SSD 970 EVO Plus 1TB
\\.\PHYSICALDRIVE2 Lexar SD  WorkflowUR2 USB Device 2          15924142080   Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE3 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE1 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE2
The system cannot find the drive specified.

laptop buildin sd card slot not working too

PS C:\Users\Eugene> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
Samsung SSD 970 EVO Plus 1TB  \\.\PHYSICALDRIVE0  Samsung SSD 970 EVO Plus 1TB  3           1000202273280
PciE SDHC-Card                \\.\PHYSICALDRIVE1  PciE SDHC-Card                2           15924142080

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.

same problem here

r12f commented 2 years ago

Same problem here as well. Unable to read the USB SD reader.

DeviceID            Caption                      Partitions Size           Model
--------            -------                      ---------- ----           -----
\\.\PHYSICALDRIVE10 NORELSYS 1081 USB Device     1          1023866403840  NORELSYS 1081 USB Device

> wsl --mount "\\.\PHYSICALDRIVE10"
The system cannot find the drive specified.

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

> wsl --mount "\\.\PHYSICALDRIVE10" --partition 1
The system cannot find the drive specified.
The-MAZZTer commented 2 years ago

I found this third party tool which allows you to mount USB devices in WSL:

https://github.com/dorssel/usbipd-win

I was able to get my SD card reader to show up in lsusb, however I could not get any devices to show up in /dev/ for the drive/partitions themselves on my microSD card. But from some of the things I'm reading on there it sounds like some devices do mount properly. So this may work for some devices.

akash07k commented 2 years ago

+1 it will be very much appreciated if MSFT adds the support for USB flash drives. I too need to manipulate my raspberry pi SD card from Windows. @microsoft please help

akash07k commented 2 years ago

now nothing is mentioned in the limitations section on the docs page about USB drives. still the issue persists

danielaustralia1 commented 2 years ago

can confirm the issue exists & in my case stops me being able to use a USD sd card reader in wsl to edit rasberry pi sd card configurations

lrybak commented 1 year ago

Same for me

pedroadame commented 1 year ago

Same here. This needs to be addressed ASAP.

pedroadame commented 1 year ago

I found this third party tool which allows you to mount USB devices in WSL:

https://github.com/dorssel/usbipd-win

I was able to get my SD card reader to show up in lsusb, however I could not get any devices to show up in /dev/ for the drive/partitions themselves on my microSD card. But from some of the things I'm reading on there it sounds like some devices do mount properly. So this may work for some devices.

Same. Got it working up to lsusb step, but from there, no way of mounting the SD card to be able to modify its files.

prudx commented 1 year ago

Also having this issue, need WSL support for microsd card via USB

Ifiht commented 1 year ago

Bump for same, builtin SD reader on SurfaceBook cannot mount into WSL.

dewijones92 commented 1 year ago

would love this feature please

Michael-Gibbons commented 1 year ago

Same issue for me, sd and sd card reader

Easampson commented 1 year ago

Same issue, please provide a solution via wsl or enable ext4 support

Cpt-Dingus commented 1 year ago

Hello, hoping this will bump the issue. Currently experiencing the same thing with a standard USB drive.

`PS C:\Users\Meti> Get-CimInstance -query "SELECT * from Win32_DiskDrive"

DeviceID Caption Partitions Size Model


\.\PHYSICALDRIVE2 WDC WD10JPVT-00MS8T0 1 1000202273280 WDC WD10JPVT-00MS8T0 \.\PHYSICALDRIVE0 CT500MX500SSD1 3 500105249280 CT500MX500SSD1 \.\PHYSICALDRIVE3 Kingston DataTraveler 3.0 USB Device 2 30943503360 Kingston DataTraveler 3.0 USB Device \.\PHYSICALDRIVE1 Apacer AS350 240GB 2 240054796800 Apacer AS350 240GB

PS C:\Users\Meti> wsl --mount \.\PHYSICALDRIVE3 --bare The system cannot find the drive specified.`

LCC-gblack commented 1 year ago

This is still an issue for me.

dremsol commented 1 year ago

Same here as explained in #8885

absolutelynothelix commented 1 year ago

imagine it's still not fixed

liamness commented 1 year ago

Was trying to use WSL to copy games and other things over to an SD card formatted for a Steam Deck. Saw the following behaviour:

> wsl --mount \\.\PHYSICALDRIVE1 --partition 1
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/0x8007000f
longxk commented 1 year ago

Two years later, still not fixed.

PS C:\Users\Loong> wsl --mount \\.\PHYSICALDRIVE2 --bare
系统找不到指定的驱动器。
Error code: Wsl/Service/AttachDisk/0x8007000f
TheR3d0ne commented 1 year ago

Same problem here:

C:\Windows\System32>wsl --mount  \\.\PHYSICALDRIVE2 --bare
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/0x8007000f
pirafrank commented 1 year ago

Hi, same issue here. running latest WSL2 as of today and Windows 11 Pro 22H2. Below the output.

PS C:\WINDOWS\system32 ~ wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/0x8007000f

PS C:\WINDOWS\system32 ~ wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/0x8007000f
akash07k commented 1 year ago

I do not think Microsoft has any fix for this in their roadmap as of now. there is no benefit of commenting on this issue unless we directly mention someone from the WSL2 team who can get it implemented.

akash07k commented 1 year ago

@benhillis and @OneBlue Can you please help in this getting it fixed? It will be very helpful.

I do not think Microsoft has any fix for this in their roadmap as of now. there is no benefit of commenting on this issue unless we directly mention someone from the WSL2 team who can get it implemented.

knightian commented 1 year ago

Still cannot do it lol