Skip to content

Running KVM Nested in Microsoft Hyper-V


    The other day I was doing some training for my Linux Foundation Certified System Administrator Exam and I needed to practice configuring KVM VM’s and networking so I decided I would give it a shot. In the past I’ve worked with VMWare ESXI and a few other Level-1 Hyper-visors there were able to run other hyper-visors within them, this is a term referred to as nesting, so I just assumed that Microsoft Hyper-V would let me do this by default… I was wrong. So after messing with it a bit I eventually did get it working so I figured I would do a quick write-up because I couldn’t see the information posted anywhere else, so here we go.



  • Windows 10
  • Microsoft Hyper-V Feature Enabled
  • An installed copy of Linux in Hyper-V
  • Powershell (Enabled by default in Windows 10)



  1. Download this powershell script from Github (It’s written by Microsoft don’t worry)
  2. Copy the script to your desktop
  3. Open up your Windows Powershell (Run it as admin)
  4. Browse to the location of your Powershell Script
  5. Run the following command to allow for script execution in Powershell
    1. Set-ExecutionPolicy Bypass
  6. Now just go ahead and type .\nameofyourscript.ps1 NAMEOFYOURLINUXVMINHYPERV
  7. If all goes well it should prompt you asking if you want to expose Virtualization Extensions this is a yes, you can enable any of the other additions if you so wish as well.
  8. After the script completes just go ahead and boot back up your VM in Hyper-V and you should now have access to the virtualization extensions required for KVM/XEN


The process is fairly simply but I couldn’t find any simple outline on how to get this all working, Microsoft suggests this is only so you can nest other Hyper-V instances however I wanted to do this with KVM/XEN turns out their script works great for this, thanks Microsoft! If you have any questions feel free to leave a comment and I’ll get back to you as soon as possible.

10 Comments Post a comment
  1. nickwalt #

    Hi Ian, from what I could find, this is the only article to discuss the support of nesting non-Microsoft hypervisors inside Hyper-V. How did it go?

    I’m wanting to nest KVM/QEMU inside Hyper-V Desktop (Windows 10) to run network labs, but this is my only PC and I can’t risk loosing the setup if something becomes a problem.

    Can you post an update to this great article?


    June 18, 2016
    • Nick,

      That’s why I posted it in the first place! So I didn’t mess with it too much just enough to get some test lab stuff setup but as far as I could tell it was working fine. I’m not too sure about how v-networking was working within the nested KVM other then passthrough was working fine, your mileage may vary though with that one. You won’t lose the setup or anything like that, you just enable hyper-v and then install it in a VM worse comes to worse you just disable hyper-v and move on your way. Nothing discussed here will touch your actual PC install at all it’s all nested within VM’s so nothing to worry about on that front. Personally I would prefer to run KVM/XEN on baremetal with Hyper-V nested but that’s just a personal preference no reason to do it that way. Anyway good luck the setup for this is pretty simple and worked fine for me!

      June 18, 2016
  2. nickwalt #

    Thanks, Ian. Amazing that more people aren’t finding their way to your article to comment on the limitations of Hyper-V for Windows 10 and trying the PowerShell script you point to. If it works well it may be a great solution for many people.

    I’m a bit surprised that Microsoft isn’t improving Hyper-V on Windows 10 to the level of the features and usability that many SysOps and DevOps require (and already found in VMware Workstation). Although, a stable Type 1 hypervisor with that kind of capability would quickly disrupt things.

    If I give it a go I’ll report back. Cheers.

    June 18, 2016
    • Nick,

      From what I can gather Microsoft has been trying to work on Hyper-V and bringing it into the enterprise however VMWare ESXI has been the de-facto for many Microsoft based organisations for years and just provides way more in terms of a feature set. Until Microsoft can reach full feature parity with ESXI/XEN/KVM I doubt they’ll see much of an increase in market share. There’s always the looming problem of bias towards their OS’s with their particular Hypervisor as well, that being said recently Microsoft has been pushing more for open source software so hopefully Hyper-V will become a stable type 1 hyperviser for running Linux etc under Windows.

      The biggest issue that I’ve seen with both Hyper-V and ESXI is that they are essentially walled gardens, they lock down hardware passthrough to specific vendors and then stop you from using anything else. It goes far beyond the stuff you’re doing being “unsupported” and sits firmly in the realm of we will not let you use X with our software. A great example is NVIDIA GPU passthrough with ESXI, they’ve locked it specifically to using their K series cards that cost thousands of dollars whereas with KVM you can easily pass through these cards. (This is both NVIDIA and VMWare’s doing).

      Anyway let me know if you have any issues and hopefully I can help you out. Cheers!

      June 18, 2016
  3. nickwalt #

    Yeah, I think Microsoft still have a difficult time with UI and UX. It is a company that is better at plumbing. Perhaps they should have hired the Workstation team that got fired recently.

    Microsoft wants to capture the hearts and minds of DevOps (and SysOps?). Not making Hyper-V Desktop sing and dance like VMware Workstation isn’t going to help them do that.

    I agree that lock-in is a big problem. Thankfully, open source is growing stronger, more capable and increasingly more influential every day.

    I’ll let you know how it goes. I want to have a crack at running UnetLab on Ubuntu 16.04:

    June 18, 2016
  4. Mani #


    I followed the steps and am able to see that virtualization is enabled in linux guest running in hyper-v on Windows 10 on a Lenovo Thinkpad Yoga.

    $ sudo kvm-ok
    INFO: /dev/kvm does not exist
    HINT: sudo modprobe kvm_intel
    INFO: Your CPU supports KVM extensions
    KVM acceleration can be used

    However, I’m unable to enable virtualization.

    $ sudo modprobe kvm_intel
    modprobe: ERROR: could not insert ‘kvm_intel’: Input/output error

    $ grep vmx /proc/cpuinfo
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc rep_good nopl nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm tpr_shadow vnmi ept vpid fsgsbase bmi1 avx2 smep bmi2 erms xsaveopt

    Has any one else run into this issue ? Any suggestions ?


    August 4, 2016
    • Is VTX enabled in your BIOS? Even if you enabled it via the powershell script for the VM it could or could not be enabled in BIOS that’s what I would look for first. Outside of that I would have to look more deeply into the issue you’re presenting I haven’t run into it personally.

      August 4, 2016
      • Mani #

        Hi Ian, Thank you for the prompt reply. Yes VT-x is enabled in the BIOS of my laptop.

        August 4, 2016
    • Archie #

      I have exactly the same issue.

      August 17, 2016
    • amsofthome #

      I have exactly the same issue. No /dev/kvm, but lsmod can see the kvm.

      August 17, 2016

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: