1

Ubuntu behave sometimes different in Virtualbox client then standalone. I want, in terminal, to detect if Ubuntu is running in Virtualbox client. Even if Virtualbox Guest additions are not installed. Which happens sometimes. Is that possible? If so how?

My search direction was something similar as VBox guest addition. Guest additional does communicate with Virtualbox host. So maybe a signal can be capture. But this direction gets to complicated. I presume there must be a difference between Ubuntu running standalone, and Ubuntu in VM client what can be captured. virtualbox-server-client-topology title seems to cover the topic, but the content, in my view, not. But I have no idea what and even how to search.

Bernard
  • 461
  • 2
  • 4
  • 16
  • @SylvainPineau gave a comment with a link to http://askubuntu.com/questions/72013/command-to-determine-whether-ubuntu-is-running-in-a-virtual-machine That is the solution. Sorry I could not find this myself. Sylvain I want to mark your comment as positive but it seems not to exist any more. Please do answer, so I can mark it as accepted. – Bernard Jul 18 '14 at 12:40
  • 1
    This kind of comment is automatically added when people votes to close a question as a possible duplicate (and removed once closed). If one of the answers in this link helped you, just up-vote them :) – Sylvain Pineau Jul 18 '14 at 13:37

1 Answers1

1

If I run lspci on a LiveCD booted in VirtualBox I see a couple of devices which give it away:

00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service

I haven't installed the Guest additions.

If this is scripted, you could do something as simple as:

if [[ lspci | grep VirtualBox >/dev/null ]]; then
   ...
fi
Oli
  • 293,335
  • Another, perhaps cleaner way to silence grep's output is to use -q. – fkraiem Jul 18 '14 at 12:54
  • @Oli I like your suggestion very much for 2 reasons. 1)lspci is default installed on Ubuntu. 2) No sudo rights needed. I just call 'lspci | grep VirtualbBox' and read the exitcode. Thanks a lot. – Bernard Jul 18 '14 at 13:53