Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if I'm running in a VMWARE virtual machine (from linux)?

I have a VMWARE ESX server. I have Redhat VMs running on that server. I need a way of programatically testing if I'm running in a VM. Ideally, I'd like to know how to do this from Perl.

like image 852
tomdee Avatar asked Feb 12 '09 11:02

tomdee


People also ask

How can I tell if a virtual machine is running in Linux?

You can use The showvminfo command for show information about a particular virtual machine. This is the same information as VBoxManage list vms would show for all virtual machines.

Is VMware running on Linux?

VMware Workstation runs on standard x86-based hardware with 64-bit Intel and AMD processors, and on 64-bit Windows or Linux host operating systems.


3 Answers

See the answer to "Detect virtualized OS from an application?".

like image 119
Jonas Engström Avatar answered Oct 25 '22 14:10

Jonas Engström


You shouldn't 100% depend on any method, as they are undocumented features/bugs - they work on some host OSes and some virtualization solutions, but there is no guarantee that they will continue working; indeed, the whole point of virtualization is to be as undistinguishable from real metal as possible. With this in mind, the blue pill red pill (which is mentioned in the accepted answer to this similar question) seems to work ... for now.

like image 42
2 revs Avatar answered Oct 25 '22 14:10

2 revs


VMWare has a couple of SDK's, including an SDK for Perl.

like image 38
Graeme Perrow Avatar answered Oct 25 '22 16:10

Graeme Perrow