Is there a test to see if hardware virtualization (vmx / svm) are presently enabled within a Linux session?

The answer comes from the similar question brian99 pointed at.

Install kvm-ok for your distro (from cpu-checker under Debian/Ubuntu). Run kvm-ok which will then check the various prerequisites for hardware virtualization are present:

  • CPU flags
  • BIOS enabled
  • kvm/svm modules present.
  • /dev/kvm present

The output should indicate whether your system is capable, or what capabilities are missing to make so. Exit status should (I haven't confirmed) also be testable (shown below).

Sample run:

$ sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
$ echo $?
0

It is actually even easier than installing an additional utility - just try to load the relevant kvm module, or check if it is loaded with lsmod. If kvm loads, you're all set, if not - you need to edit the BIOS settings, and perform a cold restart,


A very similar question was asked a few months ago on askubuntu, and has some possible answers.