Does your CPU support virtualization?

Video 010 of 140 in Virtualization Foundations, in the unit “Setting up your lab machine”. 3:50, with English and Hindi audio.

A virtual machine is a complete computer that runs inside another computer. To run at a useful speed, it needs help from the processor. Before you build a lab, check that your processor offers that help and that it is switched on. This article explains where the help comes from, how to check for it on Linux and Windows, and what to change when the check fails.

What you will learn

Why processors needed a change for virtual machines

A hypervisor is the program that shares one computer among several virtual machines. Each virtual machine thinks it has the whole computer to itself. The hypervisor must keep them apart, and some of the processor's own instructions make that hard to do safely.

In the year 2000, researchers found seventeen instructions in the common x86 processor that a hypervisor could not catch. Intel answered in 2005 by adding hardware support called VT-x. AMD added its own version, called AMD-V, in 2006. Both do the same job: they let the hypervisor run virtual machines safely and quickly.

KVM is the Linux feature that uses this help to run virtual machines. Without the processor support, KVM cannot be used at all, and the virtual machines fall back to a much slower software mode.

How to check a Linux machine from the terminal

On Linux, the lscpu command prints the details of the processor. Its output includes a Virtualization line when the support exists. Filter the output to see only that line.

Show the virtualization line from lscpu
lscpu | grep Virtualization

A second check reads the processor information file directly. Intel processors report the flag vmx, and AMD processors report the flag svm. Count the flags with grep.

Count the virtualization flags in the processor information
grep -c -E 'vmx|svm' /proc/cpuinfo

Note: A count above zero means the processor reports the feature. A count of zero means the support is switched off or missing, so check the firmware setting next.

How to check Windows, and why Apple chip Macs do not qualify

On Windows, open Task Manager, then the Performance tab, then CPU. A line there shows whether virtualization is enabled. Use the same idea on any PC: the check passes only when the support is both present and switched on.

A Mac with an Apple chip has neither VT-x nor AMD-V. It cannot be the lab host. Use a PC or a cloud machine for the lab instead.

Note: Some older machines cannot switch the support on at all, even when the setting appears. Do not spend hours searching for it. Use a cloud machine as the lab host.

What to change when the check fails

Firmware is the built-in software that starts the machine before any operating system runs. It holds the settings that control the processor. To change one, restart the machine and open its setup screen.

Check your Linux machine

You need a Linux terminal on the machine you plan to use. You will run two commands. Each one shows whether the processor offers virtualization support.

  1. Ask lscpu for its virtualization line. This shows which kind of support the processor offers.

    lscpu | grep Virtualization

    What you should see: A VT-x line means Intel, an AMD-V line means AMD, and no line means no support.

  2. Count the virtualization flags in the processor information file. This checks the same support from a second source.

    grep -c -E 'vmx|svm' /proc/cpuinfo

    What you should see: A number above zero means the processor reports the feature. Zero means you must check the firmware setting.

Terms

Hypervisor
The program that shares one computer among several virtual machines and keeps them apart.
VT-x and AMD-V
Extra instructions inside Intel and AMD processors that let a hypervisor run virtual machines safely and quickly.
KVM
The Linux feature that uses the processor's virtualization support to run virtual machines quickly.
Firmware
The built-in software that starts a machine before any operating system runs, and that holds its hardware settings.

Check yourself

Which command shows the virtualization support of a processor on Linux?

Run lscpu | grep Virtualization. A VT-x line means Intel, an AMD-V line means AMD, and no line means no support.

What does a count of zero from the grep check mean?

The processor does not report the vmx or svm flag, so the support is switched off or missing. Check the firmware setting.

What should you do if the processor cannot switch virtualization on at all?

Use a cloud machine as the lab host instead of this computer.

Previous: What your lab machine is for. Next: Installing Ubuntu 24.04 LTS.