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?
Check if Ubuntu is being installed in VirtualBox VM
linux;ubuntu;virtualbox;virtual machine
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 VirtualBoxlspci | grep VirtualBoxI'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).