A prebuilt WSL2 Linux kernel with SocketCAN and vcan enabled, allowing native CAN interface usage inside WSL2 — without a virtual machine, USB-CAN adapter, or UDP tunneling.
- Custom WSL2 kernel:
6.6.x-microsoft-standard-WSL2+ - Native SocketCAN support (
CONFIG_CAN,CONFIG_CAN_RAW,CONFIG_CAN_VCAN) vcanvirtual CAN interface support- Compatible with standard Linux CAN tools (
ip,can-utils) - No external hardware or virtualization required
- Windows with WSL2 enabled
- A Linux distribution running under WSL2 (Ubuntu recommended)
- Administrator access on Windows (to edit
.wslconfig)
Place the kernel image in a folder on Windows, for example:
C:\wsl-kernels\vcan-bzImage
Create or edit:
C:\Users\<your-username>\.wslconfig
Add:
[wsl2]
kernel=C:\\wsl-kernels\\vcan-bzImagewsl --shutdownThen start WSL again.
uname -aExpected output should include:
...-microsoft-standard-WSL2+
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0Verify:
ip link show vcan0Or:
ifconfig vcan0If
ifconfigis not available:sudo apt update && sudo apt install net-tools
Install CAN utilities:
sudo apt update && sudo apt install can-utilsTerminal 1:
candump vcan0Terminal 2:
cansend vcan0 123#DEADBEEFIf working correctly, the frame will appear in candump.
pip3 install python-canTo restore the default WSL2 kernel, edit .wslconfig:
[wsl2]
# kernel=C:\\wsl-kernels\\vcan-bzImageThen restart WSL:
wsl --shutdownvcan0 cannot be created
Ensure WSL restarted after modifying .wslconfig and the custom kernel is active.
modprobe vcan fails
This kernel has vcan built-in. Use:
ip link add dev vcan0 type vcanifconfig not found
sudo apt install net-tools🚀 Trending on r/embedded
Context: This custom kernel was engineered as a foundational utility for EVO vHIL—a full-stack virtual validation framework for EV powertrains. It enables native CAN bridging between Renode simulations and Android Automotive without physical USB-to-CAN adapters.
👉 Read the full architectural write-up on my portfolio: vishal.evovhil.com/wsl2-socketcan
If this helped you, consider giving the repo a ⭐