WSL2 SD Card Support Fix Guide

·

2 min read

Root Cause

WSL2's default kernel lacks SD card support due to Microsoft removing the CONFIG_USB_STORAGE module in their official WSL2 kernel.

Solution

Re-enable SD card support using a custom kernel.


Step 1: Install Custom Kernel

  1. Download Prebuilt Kernel
    Visit Locietta/xanmod-kernel-WSL2 Releases page

    • Recommended: x64v2 version (compatible with most modern CPUs)
  2. Place Kernel File
    Save the downloaded bzImage to your Windows user directory, e.g.:

C:\Users\YourUsername\custom-wsl2-kernel


  1. Configure WSL2
  • Create .wslconfig in your user directory

  • Add configuration (note path escaping):

      [wsl2]
      kernel = C:\\Users\\YourUsername\\custom-wsl2-kernel
    
  1. Restart WSL2
    Execute in PowerShell:
wsl --shutdown

Step 2: Configure USB Redirection

  1. Install USB/IP Tool
    Install via Winget:

     winget install --interactive --exact dorssel.usbipd-win
    
  2. Bind SD Card Device

    • List USB devices:

        usbipd list
      
    • Note target device's BUS-ID (e.g., 3-1)

    • Bind device:

        usbipd bind --busid <BUS-ID>
      
  3. Attach to WSL2

     usbipd attach --wsl --busid <BUS-ID>
    

Verification

In WSL2 terminal execute:

dmesg | grep -i usb

Expected output:

[    5.112233] usb-storage 1-1:1.0: USB Mass Storage device detected

Technical Context

Note: USB device redirection must be re-executed after each host reboot