2

Is there any way to find out if the linux i'm running (actually installing) is running in a VMWare machine. I need to disable ntp settings if the automated install is done on a virtual machine but keep them enabled if not. VMWare tools are not installed when this check is done.

Ulve
  • 145
  • 6
  • 1
    Duplicate of http://serverfault.com/questions/189447/how-can-i-verify-from-a-command-prompt-if-a-linux-host-is-real-or-virtual – janneb Nov 01 '10 at 20:08

4 Answers4

7

If running as root to use dmidecode does not work for your needs, try lspci:

$ /sbin/lspci |grep VMware
00:0f.0 VGA compatible controller: VMware SVGA II Adapter

You (probably) don't particularly care what the virtual video card is, but you're not going to find that answer in real hardware, so you can use it as an identifier.

mattdm
  • 6,550
  • 1
  • 25
  • 48
5

I usually use dmidecode to do exactly that (though you need to have root access to do that). Look for the "BIOS Information" section, it will usually have the "Vendor" or "Version" fields set to "VMWare", "VirtualBox" or something similar.

ipozgaj
  • 1,061
  • 10
  • 10
1

You don't say what approach you're using to do this but you can certainly do it in C.

Alan B
  • 503
  • 5
  • 15
-1

You can check the MAC address...

When installed in a VM, the MAC address is using the VMWARE range format.