2

Sometimes Ubuntu behave weird, which might be because because it runs within Virtualbox as a client OS.

I want to detect if Virtualbox guestaddition is installed, from within the VM client, and which version it is.

On the server it can be detected using the Virtualbox API, but I want to be able to detect it on the VM client itself.

Virtualbox guest addition can be installed using statement how-do-i-install-guest-additions-in-a-virtualbox-vm:

sudo apt-get install virtualbox-ose-guest-x11

So apt-get must "know" about the installation. apt-get does not have a search function so I tried :

dpkg --list | grep virtualbox

with result :

bernard@bernard-vbox2:~$ dpkg --list | grep virtualbox
ii  unity-scope-virtualbox                    0.1+13.10.20130723-0ubuntu1                       all          VirtualBox scope for Unity
bernard@bernard-vbox2:~

Someting about Virtualbox, but not about Vbox guest addition

On my system I presume ( info source ) VBox guest addition is installed in

/opt/[VboxAddonsFolder]

The folder does exist on my system but I can not find a (general) method to retrieve the VBox guestaddition version.

On Takkat advise I installed VBox guest addition. My preference to do this in the terminal.

bash
sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)
sudo apt-get install virtualbox-guest-x11

Installed with succes my guestadditions.

Bernard
  • 461
  • 2
  • 4
  • 16

1 Answers1

1

Virtual Box guest additions are installed as kernel modules. To see whether guest additions are installed, and to get information on the version we can issue:

modinfo vboxguest

This will give an output similar to this:

filename:       /lib/modules/3.13.0-24-generic/updates/dkms/vboxguest.ko
version:        4.3.10
license:        GPL
description:    Oracle VM VirtualBox Guest Additions for Linux Module
author:         Oracle Corporation

Virtual Box guest additions installed on this machine hence is version 4.3.10.

Takkat
  • 142,284
  • When I execute I get : ERROR: Module vboxguest not found. – Bernard Jul 16 '14 at 17:45
  • When I execute your statement I get : ERROR: Module vboxguest not found. So I tried to find the file with : sudo find -name vboxguest with as result : ./var/lib/dkms/vboxguest ./var/lib/dkms/vboxguest/4.2.16/build/vboxguest ./opt/VBoxGuestAdditions-4.2.16/src/vboxguest-4.2.16/vboxguest

    This returns only directories but no file. My Vbox guest additions will probably be version 4.2.16 But I want to put the retrieved output as check input in my program. Your example output would be perfect for my purpose. What is my mistake?

    – Bernard Jul 16 '14 at 18:03
  • please read my previous comment. When editing this was posted by mistake, which I could not undo. So my comments are now a bit messy. Sorry for that. – Bernard Jul 16 '14 at 18:33
  • The error indicates that the guest additions are not installed. Did you try to load the .iso in the host, then mount it to the guest to start the installer there? – Takkat Jul 16 '14 at 18:49
  • Greate. I installed my GuestAddition (which I thought I had installed allready) and could execute your statement with succes. Thanks. I will vote your answer as accepted. But one question; How come I have a directory path of guest addition of guest addition, without having guest addition? – Bernard Jul 16 '14 at 19:23
  • @Bernard: on attempting to install guest additions this directory will be created to hold the installer and (more important) the uninstaller scripts. If the installation failed for any reason this directory will stay. – Takkat Jul 16 '14 at 21:10