A true story from one long night: torch on Windows segfaulted three times on the same line while loading a 26GB weights file - across three versions, on a hash-verified file. The fix wasn't new hardware. It was WSL2: the same machine, the same GPU, a second operating system running beside the first.
Windows Subsystem for Linux is real Linux - a real kernel, a real Ubuntu - running in a lightweight VM managed by Windows. Not dual-boot (no reboot to switch), not emulation (near-native speed), and nothing gets replaced.
Two worlds with a bridge: from Linux, the Windows drives appear under /mnt/c,
/mnt/d - and from Windows you run Linux commands with wsl.
torch_cpu.dll - on torch 2.6, 2.7.1 and 2.8, with and without every flag we could
throw at it. The file itself was fine (SHA-256 verified against the source). A bug in torch's
Windows build, unfixable from the outside.Three steps. Watch step 2 - the trap most guides never mention.
# 1 · Enable the features (PowerShell as admin) + reboot dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart shutdown /r /t 5 # 2 · The trap: the built-in wsl.exe is a stub that wants an interactive window. # For remote/scripted installs, install the REAL package from GitHub: # github.com/microsoft/WSL/releases -> wsl.x.x.x.x64.msi msiexec /i wsl_setup.msi /qn # 3 · Install Ubuntu (no window, no Store) wsl --install -d Ubuntu --no-launch
| What you want | How |
|---|---|
| A Linux terminal | wsl -d Ubuntu |
| A single command | wsl -d Ubuntu -- ls /root |
| A whole script | wsl -d Ubuntu -- bash /mnt/d/script.sh |
| Windows files from Linux | /mnt/c/… · /mnt/d/… |
| Linux files from Windows | \\wsl$\Ubuntu\root\… in Explorer |
| Full shutdown (frees RAM/GPU) | wsl --shutdown |
bash /mnt/d/x.sh - never a chain of quote marks.WSL's default: half your RAM. Not enough for loading a huge model - the file at
C:\Users\<you>\.wslconfig controls resources:
[wsl2] memory=26GB # how much RAM the VM gets swap=40GB # swap file - spills to disk when RAM runs out swapFile=D:\\wsl_swap.vhdx
(After changing it: wsl --shutdown for it to take effect.)
/mnt/d bridge (the 9p protocol)
cannot memory-map huge files. Loading 26GB through it fails - the fix is a plain read into
memory instead of mmap, or copying the file onto Linux's internal disk.setx WSLENV HF_TOKEN/u - and from then on
every WSL session sees the variable.| Windows native | WSL2 on the same machine | |
|---|---|---|
| Loading the model | segfault ×3 | works |
| LoRA training | impossible | 26s/step, 200MB VRAM headroom |
| Cost | - | $0 · two hours of setup |
ComfyUI and the Studio keep running on Windows as usual; Linux wakes up only for training, borrows the GPU for a few hours, and hands it back. One machine, two worlds, zero compromises.