Skip to content

Instantly share code, notes, and snippets.

@wooyey
Last active September 15, 2024 16:44
Show Gist options
  • Save wooyey/6056b5c1cf0af04f6c7335d89e8b12cc to your computer and use it in GitHub Desktop.
Save wooyey/6056b5c1cf0af04f6c7335d89e8b12cc to your computer and use it in GitHub Desktop.
WSL setup

WSL setup notes

Distro

Use Debian, Ubuntu seems to be quite outdated (ie. SSH is too old for FIDO2) Install it through M$ shop/whatever

At /etc/wsl.conf:

[boot]
systemd=true

Then restart WSL:

wsl --shutdown

Mounting external drive

  1. Forget about mounting Windows bootdrive partition - won't work

Check name of drive in PowerShell using wmic:

wmic diskdrive list brief
Caption                     DeviceID            Model                       Partitions  Size
SanDisk Extreme USB Device  \\.\PHYSICALDRIVE1  SanDisk Extreme USB Device  2           64017354240
HFM001TD3JX013N             \\.\PHYSICALDRIVE0  HFM001TD3JX013N             8           1024203640320

Mount to WSL:

wsl --mount \\.\PHYSICALDRIVE1

dmesg should show new drive/partitions

Yubikey (WIP)

Passthrough using usbip (source: https://learn.microsoft.com/en-us/windows/wsl/connect-usb)

Install USBIPD-WIN:

winget install --interactive --exact dorssel.usbipd-win

List USB devices:

>usbipd list
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-1    1050:0407  Urządzenie wejściowe USB, Czytnik Microsoft Usbccid Smart...  Shared
1-3    0b05:19b6  Urządzenie wejściowe USB                                      Not shared

Then attach to USB key on host ie. (need admin rights):

usbipd bind -b 1-1

And attach this to WSL (done automagically no need for usbip magic in WSL guest):

usbipd attach --wsl --busid 1-1
usbipd: info: Using WSL distribution 'Debian' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 172.25.224.1 to reach the host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment