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

Accessing USB storage devices in WSL 2? #7770

Open
tnqzh123 opened this issue Nov 29, 2021 · 9 comments
Open

Accessing USB storage devices in WSL 2? #7770

tnqzh123 opened this issue Nov 29, 2021 · 9 comments

Comments

@tnqzh123
Copy link

tnqzh123 commented Nov 29, 2021

Version

Microsoft Windows [Version 10.0.22504.1010]

WSL Version

WSL 2

Kernel Version

5.10.60.1-microsoft-standard-WSL2 (installed by Windows Update)

Distro Version

Ubuntu 20.04


Hi there, I need to backup my USB storage(a partitioned 64G SDXC card used in my Raspberry Pi, adapted to PC by the built-in USB SD card reader) by dd tool in WSL 2. I followed Connect USB devices | Microsoft Docs, used usbipd to attach my USB storage to WSL lightweight VM:

image

and the USB storage has shown up in lsusb output in WSL 2:

image

But no block file appears under /dev directory. Could you please tell me how to access my USB storage devices in WSL 2? Thanks.

@OneBlue
Copy link
Collaborator

OneBlue commented Nov 30, 2021

Thanks for reporting this @tnqzh123.

This isn't officially supported but I think it should work. Can you share the output of dmesg ? There might be something useful in there

@tnqzh123
Copy link
Author

tnqzh123 commented Dec 1, 2021

Hi @OneBlue

This is the output of dmesg:

Click here to show
[    0.000000] Linux version 5.10.60.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Aug 25 23:20:18 UTC 2021
[    0.000000] Command line: initrd=\initrd.img panic=-1 nr_cpus=16 swiotlb=force earlycon=uart8250,io,0x3f8,115200 console=hvc0 debug pty.legacy_count=0
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Centaur CentaurHauls
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'compacted' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000e0fff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000001fffff] ACPI data
[    0.000000] BIOS-e820: [mem 0x0000000000200000-0x00000000f7ffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000001c3dfffff] usable
[    0.000000] earlycon: uart8250 at I/O port 0x3f8 (options '115200')
[    0.000000] printk: bootconsole [uart8250] enabled
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] DMI not present or invalid.
[    0.000000] Hypervisor detected: Microsoft Hyper-V
[    0.000000] Hyper-V: privilege flags low 0xae7f, high 0x3b8030, hints 0xc2c, misc 0xe0bed7b2
[    0.000000] Hyper-V Host Build:22504-10.0-1-0.1010
[    0.000000] Hyper-V: LAPIC Timer Frequency: 0x1e8480
[    0.000000] Hyper-V: Using hypercall for remote TLB flush
[    0.000000] clocksource: hyperv_clocksource_tsc_page: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.000005] tsc: Detected 1796.563 MHz processor
[    0.005554] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.012891] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.018854] last_pfn = 0x1c3e00 max_arch_pfn = 0x400000000
[    0.024781] MTRR default type: uncachable
[    0.028987] MTRR fixed ranges enabled:
[    0.032866]   00000-3FFFF write-back
[    0.036573]   40000-7FFFF uncachable
[    0.040455]   80000-8FFFF write-back
[    0.044223]   90000-FFFFF uncachable
[    0.047949] MTRR variable ranges enabled:
[    0.052126]   0 base 000000000000 mask FFFF00000000 write-back
[    0.058351]   1 base 000100000000 mask FFF000000000 write-back
[    0.064472]   2 disabled
[    0.067120]   3 disabled
[    0.069772]   4 disabled
[    0.072960]   5 disabled
[    0.075842]   6 disabled
[    0.078890]   7 disabled
[    0.081639] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT
[    0.089302] last_pfn = 0xf8000 max_arch_pfn = 0x400000000
[    0.094988] Using GB pages for direct mapping
[    0.100636] RAMDISK: [mem 0x03235000-0x03244fff]
[    0.106050] ACPI: Early table checksum verification disabled
[    0.112541] ACPI: RSDP 0x00000000000E0000 000024 (v02 VRTUAL)
[    0.119970] ACPI: XSDT 0x0000000000100000 000044 (v01 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.130814] ACPI: FACP 0x0000000000101000 000114 (v06 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.140939] ACPI: DSDT 0x00000000001011B8 01E184 (v02 MSFTVM DSDT01   00000001 MSFT 05000000)
[    0.150758] ACPI: FACS 0x0000000000101114 000040
[    0.155913] ACPI: OEM0 0x0000000000101154 000064 (v01 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.165560] ACPI: SRAT 0x000000000011F33C 0003B0 (v02 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.175139] ACPI: APIC 0x000000000011F6EC 0000C8 (v04 VRTUAL MICROSFT 00000001 MSFT 00000001)
[    0.184957] ACPI: Reserving FACP table memory at [mem 0x101000-0x101113]
[    0.192625] ACPI: Reserving DSDT table memory at [mem 0x1011b8-0x11f33b]
[    0.201916] ACPI: Reserving FACS table memory at [mem 0x101114-0x101153]
[    0.212005] ACPI: Reserving OEM0 table memory at [mem 0x101154-0x1011b7]
[    0.220431] ACPI: Reserving SRAT table memory at [mem 0x11f33c-0x11f6eb]
[    0.229099] ACPI: Reserving APIC table memory at [mem 0x11f6ec-0x11f7b3]
[    0.238208] ACPI: Local APIC address 0xfee00000
[    0.243839] Zone ranges:
[    0.246765]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.254666]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.262561]   Normal   [mem 0x0000000100000000-0x00000001c3dfffff]
[    0.271577]   Device   empty
[    0.276048] Movable zone start for each node
[    0.282465] Early memory node ranges
[    0.287938]   node   0: [mem 0x0000000000001000-0x000000000009ffff]
[    0.297598]   node   0: [mem 0x0000000000200000-0x00000000f7ffffff]
[    0.305235]   node   0: [mem 0x0000000100000000-0x00000001c3dfffff]
[    0.312924] Initmem setup node 0 [mem 0x0000000000001000-0x00000001c3dfffff]
[    0.321336] On node 0 totalpages: 1817759
[    0.326350]   DMA zone: 59 pages used for memmap
[    0.332038]   DMA zone: 22 pages reserved
[    0.336906]   DMA zone: 3743 pages, LIFO batch:0
[    0.342890]   DMA32 zone: 16320 pages used for memmap
[    0.350816]   DMA32 zone: 1011712 pages, LIFO batch:63
[    0.359039]   Normal zone: 12536 pages used for memmap
[    0.366374]   Normal zone: 802304 pages, LIFO batch:63
[    0.374033] On node 0, zone DMA: 1 pages in unavailable ranges
[    0.374064] On node 0, zone DMA: 352 pages in unavailable ranges
[    0.397501] On node 0, zone Normal: 16896 pages in unavailable ranges
[    0.405534] ACPI: Local APIC address 0xfee00000
[    0.420057] ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
[    0.428477] IOAPIC[0]: apic_id 16, version 17, address 0xfec00000, GSI 0-23
[    0.439084] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.447914] ACPI: IRQ9 used by override.
[    0.453052] Using ACPI (MADT) for SMP configuration information
[    0.460800] smpboot: Allowing 16 CPUs, 0 hotplug CPUs
[    0.467608] [mem 0xf8000000-0xffffffff] available for PCI devices
[    0.477752] Booting paravirtualized kernel on Hyper-V
[    0.485395] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.503268] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:16 nr_node_ids:1
[    0.513761] percpu: Embedded 52 pages/cpu s173464 r8192 d31336 u262144
[    0.521058] pcpu-alloc: s173464 r8192 d31336 u262144 alloc=1*2097152
[    0.528290] pcpu-alloc: [0] 00 01 02 03 04 05 06 07 [0] 08 09 10 11 12 13 14 15
[    0.537092] Hyper-V: PV spinlocks enabled
[    0.541652] PV qspinlock hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.549846] Built 1 zonelists, mobility grouping on.  Total pages: 1788822
[    0.558403] Kernel command line: initrd=\initrd.img panic=-1 nr_cpus=16 swiotlb=force earlycon=uart8250,io,0x3f8,115200 console=hvc0 debug pty.legacy_count=0
[    0.576336] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.585716] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.594236] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.622228] Memory: 4092080K/7271036K available (16404K kernel code, 2538K rwdata, 3648K rodata, 1564K init, 2828K bss, 231304K reserved, 0K cma-reserved)
[    0.637163] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=16, Nodes=1
[    0.644261] ftrace: allocating 51335 entries in 201 pages
[    0.662918] ftrace: allocated 201 pages with 4 groups
[    0.669074] rcu: Hierarchical RCU implementation.
[    0.674101] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=16.
[    0.681278]  Rude variant of Tasks RCU enabled.
[    0.686279]  Tracing variant of Tasks RCU enabled.
[    0.692254] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.700145] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=16
[    0.710938] Using NULL legacy PIC
[    0.714398] NR_IRQS: 16640, nr_irqs: 552, preallocated irqs: 0
[    0.721433] random: crng done (trusting CPU's manufacturer)
[    0.727219] Console: colour dummy device 80x25
[    0.731966] ACPI: Core revision 20200925
[    0.736194] Failed to register legacy timer interrupt
[    0.741387] APIC: Switch to symmetric I/O mode setup
[    0.746652] Switched APIC routing to physical flat.
[    0.751783] Hyper-V: Using IPI hypercalls
[    0.755890] Hyper-V: Using enlightened APIC (xapic mode)
[    0.755981] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x19e57ad13b9, max_idle_ns: 440795275707 ns
[    0.772652] Calibrating delay loop (skipped), value calculated using timer frequency.. 3593.12 BogoMIPS (lpj=17965630)
[    0.782647] pid_max: default: 32768 minimum: 301
[    0.782647] LSM: Security Framework initializing
[    0.782647] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.782647] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.782647] x86/cpu: User Mode Instruction Prevention (UMIP) activated
[    0.782647] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 512
[    0.782647] Last level dTLB entries: 4KB 2048, 2MB 2048, 4MB 1024, 1GB 0
[    0.782647] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.782647] Spectre V2 : Mitigation: Full AMD retpoline
[    0.782647] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.782647] Spectre V2 : Enabling Restricted Speculation for firmware calls
[    0.782647] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier
[    0.782647] Spectre V2 : User space: Mitigation: STIBP via seccomp and prctl
[    0.782647] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
[    0.782647] Freeing SMP alternatives memory: 52K
[    0.782647] smpboot: CPU0: AMD Ryzen 7 4800U with Radeon Graphics (family: 0x17, model: 0x60, stepping: 0x1)
[    0.782781] Performance Events: PMU not available due to virtualization, using software events only.
[    0.792647] rcu: Hierarchical SRCU implementation.
[    0.793096] smp: Bringing up secondary CPUs ...
[    0.798696] x86: Booting SMP configuration:
[    0.802654] .... node  #0, CPUs:        #1  #2  #3  #4  #5  #6  #7  #8  #9 #10 #11 #12 #13 #14 #15
[    0.813363] smp: Brought up 1 node, 16 CPUs
[    0.827185] smpboot: Max logical packages: 1
[    0.831806] smpboot: Total of 16 processors activated (57490.01 BogoMIPS)
[    0.836341] node 0 deferred pages initialised in 0ms
[    0.843282] devtmpfs: initialized
[    0.846685] x86/mm: Memory block size: 128MB
[    0.852956] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.862666] futex hash table entries: 4096 (order: 6, 262144 bytes, linear)
[    0.872827] NET: Registered protocol family 16
[    0.878893] thermal_sys: Registered thermal governor 'step_wise'
[    0.878946] cpuidle: using governor menu
[    0.892731] ACPI: bus type PCI registered
[    0.892731] PCI: Fatal: No config space access function found
[    0.901132] Kprobes globally optimized
[    0.912767] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.921166] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.932932] raid6: skip pq benchmark and using algorithm avx2x4
[    0.942660] raid6: using avx2x2 recovery algorithm
[    0.949458] ACPI: Added _OSI(Module Device)
[    0.952656] ACPI: Added _OSI(Processor Device)
[    0.958576] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.962655] ACPI: Added _OSI(Processor Aggregator Device)
[    0.968935] ACPI: Added _OSI(Linux-Dell-Video)
[    0.972658] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.978676] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.986292] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    0.994262] ACPI: Interpreter enabled
[    0.998290] ACPI: (supports S0 S5)
[    1.002019] ACPI: Using IOAPIC for interrupt routing
[    1.012684] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    1.022940] ACPI: Enabled 2 GPEs in block 00 to 0F
[    1.032282] iommu: Default domain type: Translated
[    1.042764] SCSI subsystem initialized
[    1.047541] ACPI: bus type USB registered
[    1.052029] usbcore: registered new interface driver usbfs
[    1.052662] usbcore: registered new interface driver hub
[    1.059128] usbcore: registered new device driver usb
[    1.072726] hv_vmbus: Vmbus version:5.2
[    1.077963] PCI: Using ACPI for IRQ routing
[    1.072726] hv_vmbus: Unknown GUID: c376c1c3-d276-48d2-90a9-c04748072c60
[    1.082655] PCI: System does not support PCI
[    1.090120] hv_vmbus: Unknown GUID: 6e382d18-3336-4f4b-acc4-2b7703d4df4a
[    1.103082] hv_vmbus: Unknown GUID: dde9cbc0-5060-4436-9448-ea1254a5d177
[    1.102919] clocksource: Switched to clocksource tsc-early
[    1.272251] VFS: Disk quotas dquot_6.6.0
[    1.277272] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    1.285938] FS-Cache: Loaded
[    1.289441] pnp: PnP ACPI init
[    1.293321] pnp 00:00: Plug and Play ACPI device, IDs PNP0501 (active)
[    1.301648] pnp 00:01: Plug and Play ACPI device, IDs PNP0501 (active)
[    1.309482] pnp 00:02: Plug and Play ACPI device, IDs PNP0b00 (active)
[    1.317860] pnp: PnP ACPI: found 3 devices
[    1.330816] NET: Registered protocol family 2
[    1.335929] IP idents hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    1.345817] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    1.356287] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    1.366679] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    1.375963] TCP: Hash tables configured (established 65536 bind 65536)
[    1.383618] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    1.392176] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    1.400324] NET: Registered protocol family 1
[    1.405926] RPC: Registered named UNIX socket transport module.
[    1.412965] RPC: Registered udp transport module.
[    1.417922] RPC: Registered tcp transport module.
[    1.423075] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.429887] PCI: CLS 0 bytes, default 64
[    1.434229] Trying to unpack rootfs image as initramfs...
[    1.440848] Freeing initrd memory: 64K
[    1.444860] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    1.451704] software IO TLB: mapped [mem 0x00000000f4000000-0x00000000f8000000] (64MB)
[    1.464221] kvm: no hardware support
[    1.470409] kvm: Nested Virtualization enabled
[    1.476002] SVM: kvm: Nested Paging enabled
[    1.481794] SVM: Virtual VMLOAD VMSAVE supported
[    1.492388] Initialise system trusted keyrings
[    1.497590] workingset: timestamp_bits=46 max_order=21 bucket_order=0
[    1.505285] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.511576] NFS: Registering the id_resolver key type
[    1.517999] Key type id_resolver registered
[    1.522328] Key type id_legacy registered
[    1.526750] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.534313] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    1.542390] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    1.552055] Key type cifs.idmap registered
[    1.556718] fuse: init (API version 7.32)
[    1.561415] SGI XFS with ACLs, security attributes, realtime, scrub, repair, quota, no debug enabled
[    1.572242] 9p: Installing v9fs 9p2000 file system support
[    1.578598] FS-Cache: Netfs '9p' registered for caching
[    1.584472] FS-Cache: Netfs 'ceph' registered for caching
[    1.590352] ceph: loaded (mds proto 32)
[    1.597490] NET: Registered protocol family 38
[    1.602416] xor: automatically using best checksumming function   avx
[    1.610614] Key type asymmetric registered
[    1.615253] Asymmetric key parser 'x509' registered
[    1.620721] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    1.630634] hv_vmbus: registering driver hv_pci
[    1.636214] hv_pci 79ebf12f-ef09-4b4f-b5a7-dd86e5ca1279: PCI VMBus probing: Using version 0x10003
[    1.648415] hv_pci 79ebf12f-ef09-4b4f-b5a7-dd86e5ca1279: PCI host bridge to bus ef09:00
[    1.657584] pci_bus ef09:00: root bus resource [mem 0x9ffe00000-0x9ffe02fff window]
[    1.667275] pci ef09:00:00.0: [1af4:1043] type 00 class 0x010000
[    1.676682] pci ef09:00:00.0: reg 0x10: [mem 0x9ffe00000-0x9ffe00fff 64bit]
[    1.685800] pci ef09:00:00.0: reg 0x18: [mem 0x9ffe01000-0x9ffe01fff 64bit]
[    1.695554] pci ef09:00:00.0: reg 0x20: [mem 0x9ffe02000-0x9ffe02fff 64bit]
[    1.710850] pci ef09:00:00.0: BAR 0: assigned [mem 0x9ffe00000-0x9ffe00fff 64bit]
[    1.720341] pci ef09:00:00.0: BAR 2: assigned [mem 0x9ffe01000-0x9ffe01fff 64bit]
[    1.729462] pci ef09:00:00.0: BAR 4: assigned [mem 0x9ffe02000-0x9ffe02fff 64bit]
[    1.739417] hv_pci e32273c3-18d8-4508-9b6c-92128b11c5f1: PCI VMBus probing: Using version 0x10003
[    1.749955] hv_pci e32273c3-18d8-4508-9b6c-92128b11c5f1: PCI host bridge to bus 18d8:00
[    1.759350] pci 18d8:00:00.0: [1414:008e] type 00 class 0x030200
[    1.773846] ACPI: AC Adapter [AC1] (on-line)
[    1.780457] battery: ACPI: Battery Slot [BAT1] (battery present)
[    1.787968] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.795397] 00:00: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    1.805314] 00:01: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[    1.878735] Non-volatile memory driver v1.3
[    1.884049] printk: console [hvc0] enabled
[    1.889648] printk: bootconsole [uart8250] disabled
[    1.899036] brd: module loaded
[    1.900915] loop: module loaded
[    1.901667] hv_vmbus: registering driver hv_storvsc
[    1.903397] wireguard: WireGuard 1.0.0 loaded. See www.wireguard.com for information.
[    1.904473] scsi host0: storvsc_host_t
[    1.904557] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[    1.904582] tun: Universal TUN/TAP device driver, 1.6
[    1.907011] PPP generic driver version 2.4.2
[    1.908145] PPP BSD Compression module registered
[    1.909042] PPP Deflate Compression module registered
[    1.909845] PPP MPPE Compression module registered
[    1.910584] NET: Registered protocol family 24
[    1.911285] hv_vmbus: registering driver hv_netvsc
[    1.912150] VFIO - User Level meta-driver version: 0.3
[    1.913199] usbcore: registered new interface driver cdc_acm
[    1.914206] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    1.915250] usbcore: registered new interface driver ftdi_sio
[    1.916171] usbserial: USB Serial support registered for FTDI USB Serial Device
[    1.917355] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller
[    1.918217] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 1
[    1.919350] vhci_hcd: created sysfs vhci_hcd.0
[    1.920144] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.10
[    1.921126] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.922097] usb usb1: Product: USB/IP Virtual Host Controller
[    1.923103] usb usb1: Manufacturer: Linux 5.10.60.1-microsoft-standard-WSL2 vhci_hcd
[    1.924638] usb usb1: SerialNumber: vhci_hcd.0
[    1.925548] hub 1-0:1.0: USB hub found
[    1.926151] hub 1-0:1.0: 8 ports detected
[    1.926840] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller
[    1.927649] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 2
[    1.928666] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.929720] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.10
[    1.930716] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.931798] usb usb2: Product: USB/IP Virtual Host Controller
[    1.932584] usb usb2: Manufacturer: Linux 5.10.60.1-microsoft-standard-WSL2 vhci_hcd
[    1.933489] usb usb2: SerialNumber: vhci_hcd.0
[    1.934278] hub 2-0:1.0: USB hub found
[    1.935027] hub 2-0:1.0: 8 ports detected
[    1.935509] hv_vmbus: registering driver hyperv_keyboard
[    1.936421] rtc_cmos 00:02: RTC can wake from S4
[    1.960157] rtc_cmos 00:02: registered as rtc0
[    1.962210] rtc_cmos 00:02: setting system clock to 2021-12-01T00:20:16 UTC (1638318016)
[    1.963611] rtc_cmos 00:02: alarms up to one month, 114 bytes nvram
[    1.964946] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com
[    1.966149] device-mapper: raid: Loading target version 1.15.1
[    1.966918] usbcore: registered new interface driver usbhid
[    1.967529] usbhid: USB HID core driver
[    1.968092] hv_utils: Registering HyperV Utility Driver
[    1.968740] hv_vmbus: registering driver hv_utils
[    1.969430] hv_vmbus: registering driver hv_balloon
[    1.969455] hv_utils: cannot register PTP clock: 0
[    1.970058] hv_vmbus: registering driver dxgkrnl
[    1.970751] hv_balloon: Using Dynamic Memory protocol version 2.0
[    1.971424] (NULL device *): dxgk: dxg_drv_init  Version: 2108
[    1.971644] hv_utils: TimeSync IC version 4.0
[    1.974697] Free page reporting enabled
[    1.975256] hv_balloon: Cold memory discard hint enabled
[    1.976504] (NULL device *): dxgk: mmio allocated 9ffe10000  200000000 9ffe10000 bffe0ffff
[    1.978634] drop_monitor: Initializing network drop monitor service
[    1.979559] Mirror/redirect action on
[    1.980395] IPVS: Registered protocols (TCP, UDP)
[    1.981143] IPVS: Connection hash table configured (size=4096, memory=64Kbytes)
[    1.982124] IPVS: ipvs loaded.
[    1.982640] IPVS: [rr] scheduler registered.
[    1.983305] IPVS: [wrr] scheduler registered.
[    1.983909] IPVS: [sh] scheduler registered.
[    1.984546] ipip: IPv4 and MPLS over IPv4 tunneling driver
[    1.988079] ipt_CLUSTERIP: ClusterIP Version 0.8 loaded successfully
[    1.990159] Initializing XFRM netlink socket
[    1.991007] NET: Registered protocol family 10
[    1.991976] Segment Routing with IPv6
[    1.994519] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.995625] NET: Registered protocol family 17
[    1.996400] Bridge firewalling registered
[    1.996930] 8021q: 802.1Q VLAN Support v1.8
[    1.997437] sctp: Hash tables configured (bind 256/256)
[    1.998116] 9pnet: Installing 9P2000 support
[    1.998778] Key type dns_resolver registered
[    1.999433] Key type ceph registered
[    2.000083] libceph: loaded (mon/osd proto 15/24)
[    2.000860] NET: Registered protocol family 40
[    2.001573] hv_vmbus: registering driver hv_sock
[    2.002638] IPI shorthand broadcast: enabled
[    2.003565] sched_clock: Marking stable (1952166547, 51366400)->(2163374900, -159841953)
[    2.005372] registered taskstats version 1
[    2.006086] Loading compiled-in X.509 certificates
[    2.007260] Btrfs loaded, crc32c=crc32c-generic
[    2.009589] Freeing unused kernel image (initmem) memory: 1564K
[    2.063254] Write protecting the kernel read-only data: 22528k
[    2.066109] Freeing unused kernel image (text/rodata gap) memory: 2024K
[    2.067757] Freeing unused kernel image (rodata/data gap) memory: 448K
[    2.068704] Run /init as init process
[    2.069274]   with arguments:
[    2.069747]     /init
[    2.070031]   with environment:
[    2.070454]     HOME=/
[    2.070800]     TERM=linux
[    2.442343] scsi 0:0:0:0: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    2.444828] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    2.446213] sd 0:0:0:0: [sda] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[    2.446408] scsi 0:0:0:1: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    2.447454] sd 0:0:0:0: [sda] 4096-byte physical blocks
[    2.449120] sd 0:0:0:0: [sda] Write Protect is off
[    2.449123] sd 0:0:0:1: Attached scsi generic sg1 type 0
[    2.449827] sd 0:0:0:0: [sda] Mode Sense: 0f 00 00 00
[    2.449950] sd 0:0:0:1: [sdb] 701248 512-byte logical blocks: (359 MB/342 MiB)
[    2.450059] sd 0:0:0:1: [sdb] Write Protect is on
[    2.450060] sd 0:0:0:1: [sdb] Mode Sense: 0f 00 80 00
[    2.450228] sd 0:0:0:1: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    2.453856] sd 0:0:0:1: [sdb] Attached SCSI disk
[    2.454338] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.460681] sd 0:0:0:0: [sda] Attached SCSI disk
[    2.498006] hv_pci 75d8de81-aeb8-49f6-b4d4-48f30a4804e9: PCI VMBus probing: Using version 0x10003
[    2.502228] hv_pci 75d8de81-aeb8-49f6-b4d4-48f30a4804e9: PCI host bridge to bus aeb8:00
[    2.504190] pci_bus aeb8:00: root bus resource [mem 0xc00000000-0xe00001fff window]
[    2.507697] pci aeb8:00:00.0: [1af4:105a] type 00 class 0x088000
[    2.512447] pci aeb8:00:00.0: reg 0x10: [mem 0xe00000000-0xe00000fff 64bit]
[    2.516778] pci aeb8:00:00.0: reg 0x18: [mem 0xe00001000-0xe00001fff 64bit]
[    2.521550] pci aeb8:00:00.0: reg 0x20: [mem 0xc00000000-0xdffffffff 64bit]
[    2.532822] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x19e57ad13b9, max_idle_ns: 440795275707 ns
[    2.533353] pci aeb8:00:00.0: BAR 4: assigned [mem 0xc00000000-0xdffffffff 64bit]
[    2.539674] pci aeb8:00:00.0: BAR 0: assigned [mem 0xe00000000-0xe00000fff 64bit]
[    2.543545] pci aeb8:00:00.0: BAR 2: assigned [mem 0xe00001000-0xe00001fff 64bit]
[    2.598199] virtiofs virtio1: Cache len: 0x200000000 @ 0xc00000000
[    2.600670] clocksource: Switched to clocksource tsc
[    2.683231] memmap_init_zone_device initialised 2097152 pages in 30ms
[    2.692768] EXT4-fs (sdb): mounted filesystem without journal. Opts: (null)
[    2.706256] EXT4-fs (sda): mounted filesystem with ordered data mode. Opts: (null)
[    2.708485] scsi 0:0:0:2: Direct-Access     Msft     Virtual Disk     1.0  PQ: 0 ANSI: 5
[    2.710449] sd 0:0:0:2: Attached scsi generic sg2 type 0
[    2.711604] sd 0:0:0:2: [sdc] 536870912 512-byte logical blocks: (275 GB/256 GiB)
[    2.712914] sd 0:0:0:2: [sdc] 4096-byte physical blocks
[    2.713818] sd 0:0:0:2: [sdc] Write Protect is off
[    2.714752] sd 0:0:0:2: [sdc] Mode Sense: 0f 00 00 00
[    2.715864] sd 0:0:0:2: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.720283] sd 0:0:0:2: [sdc] Attached SCSI disk
[    2.732948] EXT4-fs (sdc): recovery complete
[    2.735017] EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: discard,errors=remount-ro,data=ordered
[    2.762737] Adding 2097152k swap on /swap/file.  Priority:-2 extents:3 across:2113536k
[    2.774224] hv_pci 7350b402-1c98-478a-a877-92668a34dadc: PCI VMBus probing: Using version 0x10003
[    2.778357] hv_pci 7350b402-1c98-478a-a877-92668a34dadc: PCI host bridge to bus 1c98:00
[    2.780080] pci_bus 1c98:00: root bus resource [mem 0x9ffe04000-0x9ffe06fff window]
[    2.784484] pci 1c98:00:00.0: [1af4:1049] type 00 class 0x010000
[    2.788815] pci 1c98:00:00.0: reg 0x10: [mem 0x9ffe04000-0x9ffe04fff 64bit]
[    2.791417] pci 1c98:00:00.0: reg 0x18: [mem 0x9ffe05000-0x9ffe05fff 64bit]
[    2.794096] pci 1c98:00:00.0: reg 0x20: [mem 0x9ffe06000-0x9ffe06fff 64bit]
[    2.804856] pci 1c98:00:00.0: BAR 0: assigned [mem 0x9ffe04000-0x9ffe04fff 64bit]
[    2.807220] pci 1c98:00:00.0: BAR 2: assigned [mem 0x9ffe05000-0x9ffe05fff 64bit]
[    2.809540] pci 1c98:00:00.0: BAR 4: assigned [mem 0x9ffe06000-0x9ffe06fff 64bit]
[    2.848757] hv_pci 16e8ab42-7a40-4e11-ae0b-9539c36e7538: PCI VMBus probing: Using version 0x10003
[    2.852555] hv_pci 16e8ab42-7a40-4e11-ae0b-9539c36e7538: PCI host bridge to bus 7a40:00
[    2.853843] pci_bus 7a40:00: root bus resource [mem 0x9ffe08000-0x9ffe0afff window]
[    2.857661] pci 7a40:00:00.0: [1af4:1049] type 00 class 0x010000
[    2.861049] pci 7a40:00:00.0: reg 0x10: [mem 0x9ffe08000-0x9ffe08fff 64bit]
[    2.863679] pci 7a40:00:00.0: reg 0x18: [mem 0x9ffe09000-0x9ffe09fff 64bit]
[    2.866039] pci 7a40:00:00.0: reg 0x20: [mem 0x9ffe0a000-0x9ffe0afff 64bit]
[    2.876382] pci 7a40:00:00.0: BAR 0: assigned [mem 0x9ffe08000-0x9ffe08fff 64bit]
[    2.879106] pci 7a40:00:00.0: BAR 2: assigned [mem 0x9ffe09000-0x9ffe09fff 64bit]
[    2.881360] pci 7a40:00:00.0: BAR 4: assigned [mem 0x9ffe0a000-0x9ffe0afff 64bit]
[    2.916026] FS-Cache: Duplicate cookie detected
[    2.917368] FS-Cache: O-cookie c=00000000f641a2da [p=000000004b353481 fl=222 nc=0 na=1]
[    2.918432] FS-Cache: O-cookie d=000000003e59a712 n=0000000066cba31d
[    2.919193] FS-Cache: O-key=[10] '34323934393337353131'
[    2.919803] FS-Cache: N-cookie c=000000001f82fa01 [p=000000004b353481 fl=2 nc=0 na=1]
[    2.921025] FS-Cache: N-cookie d=000000003e59a712 n=00000000587d84fd
[    2.922052] FS-Cache: N-key=[10] '34323934393337353131'
[    2.922713] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    3.143780] hv_pci 65ef0495-326f-4b34-af06-ab327f628e34: PCI VMBus probing: Using version 0x10003
[    3.148093] hv_pci 65ef0495-326f-4b34-af06-ab327f628e34: PCI host bridge to bus 326f:00
[    3.149259] pci_bus 326f:00: root bus resource [mem 0x9ffe0c000-0x9ffe0efff window]
[    3.153486] pci 326f:00:00.0: [1af4:1049] type 00 class 0x010000
[    3.156805] pci 326f:00:00.0: reg 0x10: [mem 0x9ffe0c000-0x9ffe0cfff 64bit]
[    3.159620] pci 326f:00:00.0: reg 0x18: [mem 0x9ffe0d000-0x9ffe0dfff 64bit]
[    3.162047] pci 326f:00:00.0: reg 0x20: [mem 0x9ffe0e000-0x9ffe0efff 64bit]
[    3.174772] pci 326f:00:00.0: BAR 0: assigned [mem 0x9ffe0c000-0x9ffe0cfff 64bit]
[    3.178125] pci 326f:00:00.0: BAR 2: assigned [mem 0x9ffe0d000-0x9ffe0dfff 64bit]
[    3.180924] pci 326f:00:00.0: BAR 4: assigned [mem 0x9ffe0e000-0x9ffe0efff 64bit]
[    3.396651] hv_pci 4c0ef31b-442e-443f-89ad-d2d11505a872: PCI VMBus probing: Using version 0x10003
[    3.460134] hv_pci 4c0ef31b-442e-443f-89ad-d2d11505a872: PCI host bridge to bus 442e:00
[    3.461275] pci_bus 442e:00: root bus resource [mem 0xbffe10000-0xbffe12fff window]
[    3.465247] pci 442e:00:00.0: [1af4:1049] type 00 class 0x010000
[    3.469174] pci 442e:00:00.0: reg 0x10: [mem 0xbffe10000-0xbffe10fff 64bit]
[    3.471982] pci 442e:00:00.0: reg 0x18: [mem 0xbffe11000-0xbffe11fff 64bit]
[    3.474746] pci 442e:00:00.0: reg 0x20: [mem 0xbffe12000-0xbffe12fff 64bit]
[    3.486455] pci 442e:00:00.0: BAR 0: assigned [mem 0xbffe10000-0xbffe10fff 64bit]
[    3.488933] pci 442e:00:00.0: BAR 2: assigned [mem 0xbffe11000-0xbffe11fff 64bit]
[    3.491227] pci 442e:00:00.0: BAR 4: assigned [mem 0xbffe12000-0xbffe12fff 64bit]
[    3.528829] hv_pci c64cca2b-23e4-4128-8de1-c9534ec58d80: PCI VMBus probing: Using version 0x10003
[    3.579437] hv_pci c64cca2b-23e4-4128-8de1-c9534ec58d80: PCI host bridge to bus 23e4:00
[    3.580941] pci_bus 23e4:00: root bus resource [mem 0xbffe14000-0xbffe16fff window]
[    3.584878] pci 23e4:00:00.0: [1af4:1049] type 00 class 0x010000
[    3.589676] pci 23e4:00:00.0: reg 0x10: [mem 0xbffe14000-0xbffe14fff 64bit]
[    3.592368] pci 23e4:00:00.0: reg 0x18: [mem 0xbffe15000-0xbffe15fff 64bit]
[    3.595377] pci 23e4:00:00.0: reg 0x20: [mem 0xbffe16000-0xbffe16fff 64bit]
[    3.605901] pci 23e4:00:00.0: BAR 0: assigned [mem 0xbffe14000-0xbffe14fff 64bit]
[    3.609906] pci 23e4:00:00.0: BAR 2: assigned [mem 0xbffe15000-0xbffe15fff 64bit]
[    3.612262] pci 23e4:00:00.0: BAR 4: assigned [mem 0xbffe16000-0xbffe16fff 64bit]
[   25.688323] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[   25.689515] vhci_hcd vhci_hcd.0: devid(65539) speed(3) speed_str(high-speed)
[   25.690903] vhci_hcd vhci_hcd.0: Device attached
[   26.032780] usb 1-1: new high-speed USB device number 2 using vhci_hcd
[   26.182754] usb 1-1: SetAddress Request (2) to port 0
[   26.232097] usb 1-1: New USB device found, idVendor=05e3, idProduct=0761, bcdDevice=24.02
[   26.233567] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[   26.234670] usb 1-1: Product: USB Storage
[   26.235230] usb 1-1: SerialNumber: 000000002402

And I found that it seems USB storage support is not enabled by default in WSL's kerenel:
https://github.com/microsoft/WSL2-Linux-Kernel/blob/918dbaa9fa4aa665c9e5fe44489dd453da7cadeb/Microsoft/config-wsl#L2374-L2380

Does this mean I need to build my own kernel to support USB storage?

@tnqzh123
Copy link
Author

tnqzh123 commented Dec 1, 2021

Hi @OneBlue

I tried to build my own kernel with USB_STORAGE enabled, and it works - I can get the block files under /dev directory.

But I get another problem now: when I try to access the SD card(e.g. mount or fdisk), it will be detached, and WSL will give me an error(e.g. device does not exist). Here is the output of dmesg:

Click here to show
[  878.340464] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[  878.341793] vhci_hcd vhci_hcd.0: devid(65539) speed(3) speed_str(high-speed)
[  878.342929] vhci_hcd vhci_hcd.0: Device attached
[  878.687835] usb 1-1: new high-speed USB device number 8 using vhci_hcd
[  878.837845] usb 1-1: SetAddress Request (8) to port 0
[  878.884868] usb 1-1: New USB device found, idVendor=05e3, idProduct=0761, bcdDevice=24.02
[  878.887207] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[  878.889056] usb 1-1: Product: USB Storage
[  878.889949] usb 1-1: SerialNumber: 000000002402
[  878.894769] usb-storage 1-1:1.0: USB Mass Storage device detected
[  878.896621] scsi host1: usb-storage 1-1:1.0
[  879.903311] scsi 1:0:0:0: Direct-Access     Generic  MassStorageClass 2402 PQ: 0 ANSI: 6
[  879.905672] sd 1:0:0:0: Attached scsi generic sg3 type 0
[  880.545026] sd 1:0:0:0: [sdd] 124735488 512-byte logical blocks: (63.9 GB/59.5 GiB)
[  880.553605] sd 1:0:0:0: [sdd] Write Protect is off
[  880.555309] sd 1:0:0:0: [sdd] Mode Sense: 21 00 00 00
[  880.561771] sd 1:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  880.583556]  sdd: sdd1 sdd2
[  880.598080] sd 1:0:0:0: [sdd] Attached SCSI removable disk
[  886.188052]  sdd: sdd1 sdd2
[  917.533348] vhci_hcd: connection closed
[  917.533611] vhci_hcd: stop threads
[  917.535227] vhci_hcd: release socket
[  917.535799] vhci_hcd: disconnect device
[  917.588189] vhci_hcd: vhci_device speed not set
[  918.328047] usb 1-1: USB disconnect, device number 8
[  918.347824] scsi 1:0:0:0: rejecting I/O to dead device

The SD card reader(Genesys Logic USB2.0 Card Reader) is built-in my Lenovo YOGA 14sARE 2020(or, in the outside of Mainland China, Lenovo YOGA Slim 7 14ARE05). I've tried use another USB SD card reader(Genesys Logic USB3.0 Card Reader), it works normally. Is this problem caused by the built-in SD card reader, or WSL, or USBIPD-WIN?

@fletchersarip93
Copy link

This is a workaround that works for me: https://github.com/jovton/USB-Storage-on-WSL2

@Kilento
Copy link

Kilento commented Jun 8, 2022

Maybe it's better way to solve this issue for those who come after. https://dowww.spencerwoo.com/4-advanced/4-4-usb.html#usbip-win

@petersladek
Copy link

What a shame this doesn't work OOB. Needed to change dietpi wifi settings on sd card... Ended up using linux in VM.

@MV10
Copy link

MV10 commented Jul 1, 2023

Ridiculous that this doesn't work.

@itsdotscience
Copy link

itsdotscience commented May 2, 2024

updated #11335 w/ commit and temp. gist to build the modules .. currently presumes you've already setup the env to build it though. Confirmed mount and fdisk worked without issue as well.

@rs38
Copy link

rs38 commented Oct 18, 2024

(for USBIPD)
wouldn't it be possibe to add the USB-Mass storage as a module with sudo modprob?

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

8 participants