microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.25k stars 811 forks source link

KVM is unavailable after a wsl --shutdown #7509

Closed superlinkx closed 7 months ago

superlinkx commented 2 years ago

Windows Build Number

Microsoft Windows [Version 10.0.22000.194]

WSL Version

Kernel Version

5.10.60.1

Distro Version

Ubuntu 20.04

Other Software

libvirt-daemon 6.0.0-0ubuntu8.14 virt-manager 1:2.2.1-3ubuntu2.1

Repro Steps

  1. Install and run libvirtd (also requires running the virtlogd command)
  2. Install and run virt-manager
  3. Create a guest VM of your choice
  4. Everything should be running at this point
  5. Close things down then run wsl --shutdown to shutdown the whole WSL 2 system
  6. Reopen WSL2 (dealer's choice on exactly how, I've tried all the command line options and just opening Virt Manager from the Start menu)
  7. Try to start a VM
  8. Get Permission Denied from KVM
  9. Requires a full system reboot to get KVM back

Expected Behavior

When recovering from WSL2 shutdown, KVM should still be available in my distro without rebooting Windows.

Actual Behavior

KVM is not available after a wsl --shutdown and doesn't come back until the full Windows system is rebooted.

Diagnostic Logs

Error encountered in virt-manager GUI:

Error starting domain: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
2021-10-08T08:49:12.215371Z qemu-system-x86_64: failed to initialize KVM: Permission denied

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1279, in startup
    self._backend.create()
  File "/usr/lib/python3/dist-packages/libvirt.py", line 1234, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
2021-10-08T08:49:12.215371Z qemu-system-x86_64: failed to initialize KVM: Permission denied
microsoft-github-policy-service[bot] commented 7 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!