Runtime identification of virtualized environment



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.





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.
$200 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

Latest posts