Skip to content

Instantly share code, notes, and snippets.

@startergo
Last active October 25, 2025 19:50
Show Gist options
  • Select an option

  • Save startergo/4428c78ace77d229357b4a205f38a57a to your computer and use it in GitHub Desktop.

Select an option

Save startergo/4428c78ace77d229357b4a205f38a57a to your computer and use it in GitHub Desktop.
KVM on WSL2 Windows 11
  • In WSL2 run:
sudo apt update
sudo apt install qemu qemu-kvm bridge-utils cpu-checker
sudo apt install virt-manager
sudo addgroup kvm
sudo usermod -a -G kvm ${USER}
  • Change the default group of /dev/kvm:
sudo nano /etc/wsl.conf

In the file /etc/wsl.conf add these lines:

[boot]
command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm'
  • Enable nested virtualization. Create .wslcongfig.

  • Add this section to the .wslconfig file

[wsl2]
nestedVirtualization=true
  • Restart WSL:
wsl.exe --shutdown
  • Got an error:
Setting up udev (252.22-1~deb12u1) ...
addgroup: The group `kvm' already exists and is not a system group. Exiting.
dpkg: error processing package udev (--configure):
 installed udev package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mdevctl:
 mdevctl depends on udev; however:
  Package udev is not configured yet.
  • It can be fixed with:
 sudo mv /var/lib/dpkg/info/udev.postinst /var/lib/dpkg/info/udev.postinst.backup
@NikoSoft12
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment