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.
Asked
Active
Viewed 2,255 times
2
-
1Duplicate 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 Answers
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.
![](../../users/profiles/57468.webp)
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.
![](../../users/profiles/6470.webp)
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.
![](../../users/profiles/20792.webp)
Alan B
- 503
- 5
- 15
-
1Most of the Linux distributions have dmidecode command which basically does the same. – ipozgaj Nov 01 '10 at 16:25
-1
You can check the MAC address...
When installed in a VM, the MAC address is using the VMWARE range format.
![](../../users/profiles/99016.webp)
sqaopen
- 1
-
2Not necessarily. IIRC the MAC is fully configurable even with physical NICs, much less a virtual one. – Piskvor left the building Oct 26 '11 at 14:09