imvirt - I’m virtualized?

Posted on 2012-09-14 in Projects • 1 min read

This little perl script tries to detect if it is called from within a virtualization container. This is detected by looking for well-known boot messages, directories and reading DMI (Desktop Management Interface) data.

The following containers are detected:

  • Virtual PC/Virtual Server
  • VirtualBox
  • VMware
  • QEMU/KVM (experimental)
  • Xen (para and non-para virtualized)
  • OpenVZ/Virtuozzo
  • UML
  • any HVM providing CPUID 0x40000000 detection

The tool will print exactly one line. The result has the following meaning:

Line Detected container
HVM: <signature> signature of an unknown hypervisor1
VirtualBox VirtualBox
Virtual Machine Microsoft Virtual PC/Virtual Server
VMware VMware Virtual Platform
VMware (Express ESX Server
OpenVZ OpenVZ/Virtuosso1
Physical This is a physical machine or a not detected container.
QEMU QEMU/KVM (based)
UML User Mode Linux*
Xen Xen hypervisor
Xen 3.x (PV|HVM) Xen hypervisor1
lguest Lguest: The Simple x86 Hypervisor2
ARAnyM Atari Running on Any Machine3
LXC Linux Containers3

There are simular packages for detecting virtualization containers available:

Downloads

The most current version is 0.9.5 (view ChangeLog).

Source packages can be found here.

There are official Debian packages available here.

VCS: https://github.com/DE-IBH/imvirt

Portable

There is a portable ImVirt version (imvirtp) available. It is a self-contained perl script (using PAR Packager). Downloads are available at github.


  1. available since imvirt 0.3 

  2. available since imvirt 0.9.1 

  3. available since imvirt 0.9.3