Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

Runtime identification of virtualized environment

Discussion in 'General Linux' started by velusamyg, Jan 5, 2012.

  1. velusamyg

    velusamyg Guest

    I am a new to Linux/ Virtual Box. I am writing an application which is supposed be run on Virtualized env and also on standalone linux machines and the app is supposed to do different task based on the environment .



    I would like to identify on runtime, if my app is running on virtualized env (Virtual Box with guest OS as ubuntu and host OS as windows) OR if the app is running on standalone Linux (ubuntu) machine.

    Is there any env / config file within the ubuntu OS which will tell me the details required.

    Initially i considered, differentiation based on VBoxGuestAddition installable can help, but guestAddition installation is not mandatory on all VBox machine.

    Is there any alternate way for this identification.

    I am looking for some command or some unique file which will tell that my application is running in virtual box or not.

    Any help in this regard will be very helpful.

    Thanks,
     
  2. ehansen

    ehansen Guest

    velusamyg,

    This isn't something you find a lot online, but I have some code that works for VMware, I'm sure you can port it over to Virtual Box with some tweaking.

    I'll upload it to GitHub later tonight and post the link here for you.
     
  3. ehansen

    ehansen Guest

Share This Page