This page has been machine-translated from the original page.
Introduction
This article is about how to resolve a problem where a virtual machine created with Hyper-V stops starting on a Windows OS running on an Azure virtual machine.
The other day, when I tried to start a Linux machine on Hyper-V on Windows 10 running as an Azure VM, the following error message appeared and it would not start.
Failed to start the virtual machine 'MACHINE' because one of the Hyper-V components is not running.
In conclusion, if you want to use Hyper-V on an Azure VM, you need to choose a size that provides a CPU with support for “nested virtualization”, and it started successfully once I selected Standard D4s_v4.
Cause of the Problem
The cause of the problem above was that support for Hyper-V nested virtualization was not available.
To begin with, it seems there are various restrictions when you want to run yet another virtual machine with Hyper-V on top of a virtual machine that was itself created with Hyper-V.
After checking the documentation, I found the following limitations.
Both the Hyper-V host and guest must be Windows Server 2016 / Windows 10 Anniversary Update or later. There are also some differences in the virtual network for second-level virtual machines. Nested virtualization | Microsoft Docs
The reason for these restrictions is that Hyper-V depends on the CPU’s hardware virtualization features.
Hyper-V uses CPU features such as Intel VT-x and AMD-V.
These CPU features are used exclusively, so if Hyper-V is using them, other software normally cannot use them.
Because of that, on a virtual machine running on top of Hyper-V, you normally cannot use those CPU features to do even more virtualization.
(As far as I could tell, other VM software and VirtualBox also use these features, so they probably cannot use them either.)
However, with Hyper-V, enabling support for nested virtualization seems to make it possible to virtualize the CPU features themselves, which in turn lets you build virtual machines with Hyper-V in multiple layers.
Looking back at the issue this time, it is easy to forget, but the instances used by Azure’s VM service are already virtualized with Hyper-V in the first place.
In other words, using Hyper-V on an Azure VM is effectively doing another round of Hyper-V-based virtualization inside a machine that is already virtualized with Hyper-V.
Within Azure’s VM service, only specific virtual machine sizes support this nested virtualization.
I found information about support for nested virtualization in Azure’s VM service in the following article.
I also found the list of Azure VM sizes that can use nested virtualization here.
Overview of the Azure Compute Unit - Azure Virtual Machines | Microsoft Docs
That page includes the following note.
Hyper-threaded and capable of running nested virtualization
It looks like this Hyper-threaded entry is related to the mechanism that makes nested virtualization possible. (I’m not entirely sure.)
As a result, recreating the virtual machine with Standard D4s_v4, a 16 GB memory size that can use the Hyper-threaded feature above, fixed the problem.
Summary
As described above, the cause of this issue was that I had created the virtual machine using a resource size that does not support nested virtualization.
While identifying the cause and getting to the solution, I had tried several other things along the way.
In particular, deleting the Hyper-V virtual machine and rebuilding it took a huge amount of time and effort, so I really wish I had not done that lol
I got the impression that my lack of understanding about virtualization and CPU features, and about the problems that can happen when you build another virtual machine on top of a virtual machine, really slowed down the troubleshooting.
Even when I directly googled the error text, I could not find many useful pages, so this time I decided to write the article myself.
Eventually I arrived at the idea that it was probably a CPU issue, and helpful articles came up when I searched for things like “Azure Hyper-V size” and “Azure Hyper-V CPU”.
This kind of situation—where if you have the background knowledge, you can find the right search terms and solve it immediately—happens pretty often, doesn’t it?
Anyway, it reminded me once again that even when using cloud services, you still need knowledge of infrastructure and networking, so I want to study more seriously.