Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Duplicate of serverfault.com/questions/189447/… –  janneb Nov 1 '10 at 20:08

4 Answers 4

up vote 6 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer
1  
Most of the Linux distributions have dmidecode command which basically does the same. –  ipozgaj Nov 1 '10 at 16:25

You can check the MAC address...

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

share|improve this answer
1  
Not necessarily. IIRC the MAC is fully configurable even with physical NICs, much less a virtual one. –  Piskvor Oct 26 '11 at 14:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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