Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Sylvain Pineau, Oli Jul 18 '14 at 12:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

@SylvainPineau gave a comment with a link to… 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
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
up vote 1 down vote accepted

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
share|improve this answer
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

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