I am trying to automate the installation of Ubuntu from a network repository. I am now successfully able to configure the ISO image and it does the installation automatically.

My requirement:

I would like to know if there is a method in the initial installation stage of Ubuntu, where I can tell if the OS is being installed in VirtualBox or a physical desktop. I want this check to be performed as I want to automate the installation of the VirtualBox guest additions if the installation is being performed in VirtualBox.

How can I do this?


If you're only checking for VirtualBox and don't need to cater for all hypervisors, there's a quick and dirty way - check for the presence of VirtualBox devices.

lshw | grep VirtualBox
lspci | grep VirtualBox

I'm not sure if you'll have either or both of lshw and lspci but you can always install them as part of your custom installation (or, check the contents of /proc/pci instead of using lspci).

  • Or just dmesg | grep VirtualBox. – lcd047 Jul 13 '15 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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