13

So I'm running a VM somewhere and want to know what hypervisor the host is running. Any way to check whether it's running KVM or in a container?

The vm is running Ubuntu

15

Without external tools:

sudo dmidecode | grep -i -e manufacturer -e product -e vendor

or

sudo grep -i -e virtual -e vbox -e xen /var/log/dmesg  # or /var/log/kern.log

should give you enough to go on.

You can see checks for specific platforms in the ImVirt module.

| improve this answer | |
  • This doesn't work, at least for xen. It shows the platform's specifications even in a vm. – Fake Name Feb 18 '19 at 5:07
14

Look at virt-what

stephenm@pc:~$ apt-cache search virt-what
virt-what - detect if we are running in a virtual machine

sudo apt-get install virt-what

sudo virt-what

| improve this answer | |
  • This is how facter (puppet) determines the VM type. – jordanm Sep 18 '13 at 12:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.