Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a custom live distro that will be a specialist work environment for those of my employees that are on the road.

I am looking for ways to detect or, ideally, prevent my live distro from being run inside a virtual machine (I am only worried about Windows desktop virtualization like VMWare, VirtualBox; I'm not bothered about KVM/Xen).

Are there reasonably easy mechanisms to either cripple my live distro (e.g. by removing kernel drivers) so it does not run at all within a VM, or at least be able to detect it?

If there are, what are the potential pitfalls? The users won't be overly technical so I just need to make it hard enough to circumvent detection/reporting/running inside VM.

Any thoughts will be greatly appreciated.

share|improve this question
The VM's report them self's to the OS as VM in CPU info and other hardware info. What ever you do after you have that info is up to you. 'uname -a' should say VMware or other. – Seth Hikari Nov 21 '11 at 5:52
@SethHikari This depends on the VM. VirtualBox OSE (which is currently the most popular among free VMs) will not advertise anything at that level - you'd have to search deeper. – rozcietrzewiacz Nov 21 '11 at 10:44
Out of curiosity, why do you want to prevent it from running in a VM? – Kevin Jan 20 '12 at 16:22
And out of curiosity - what is better about XEN/KVM than VirtualBox, Hyper-V or VMWare? – Nils Jan 20 '12 at 20:11
Kevin, it's important for me to force my team to work from read-only media (the reasons for that are complicated but are mostly to do with semi-repressive nature of political regime in the country where we work for opposition parties). Most users are not tech-savvy and get only basic data security training. The live CD is meant to contain all the tools necessary for work but can be inconvenient for someone who wants to run all their usual 'fun' applications/games and because reboots wipe out changes. Therefore I want to remove the temptation of setting up VM (with shared folders capability) – knef Jan 21 '12 at 17:42

I'm afraid you will have to do many tests to create a fairly universal tester script. Here are things you might look at:

  • The output of lspci -v might contain VM name, especially in VGA description.

  • dmidecode output might be the hardest thing for a VM to fake (simulate a "real" hardware) - look for similar things as in lspci.

share|improve this answer
You're answer made me google: There's imvirt, a Perl script; virt-what looks good, too; and quite some discussion on this on stackoverflow. – sr_ Nov 21 '11 at 13:24
Wow, a very interesting method there on SO. Too bad it is not 100% accurate (as the comments indicate). – rozcietrzewiacz Nov 21 '11 at 14:18
Thank you so much, guys – knef Nov 21 '11 at 14:52
Just wanted to say thank you guys once again - the answers and links you provided have been very helpful for me to achieve what I've set out to. – knef Nov 22 '11 at 0:37
@sr_ I take back my initial enthusiasm; in today's multi-core environments, this code is pretty useless. – rozcietrzewiacz Nov 22 '11 at 9:57

Your Answer


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.