Please login or register to participate.
Wiki Page

Install VirtualBox Guest Additions


A quick note on Virtualization

For people who do not want to or are unable run on a physically dedicated server machine, virtualization is the way to go. Virtualization platforms are also very useful for debugging and problem solving where repeated testing of operating system altering use-cases is to be done - you can snapshot a particular state of the virtual machine and restore it at will for quickly reverting to the target case.

For simple and easy virtualization, and especially for developers, I recommend usage of Oracle's VirtualBox. VirtualBox provides the maximum simplicity and feature to cost ratio, especially for common development tasks. We use it quite effectively for the actual installer CD building and testing process as well.

Guest Additions

In VirtualBox, on-guest improvements are provided by installing VirtualBox guest additions through the Devices menu in the running virtual machine's window. Usually this is only installed by users in an X Windows environment like Gnome / KDE for getting basic amenities like Clipboard Copy Paste and pass-through mouse handling. We've seen substantial performance improvements when the VirtualBox Guest Additions are installed on non-GUI VMs as well. The installation of guest additions on from the installer CD (which is essentially meant to be a headless debian 5.0 lenny setup at the base linux distro level) can get a bit tricky. Let's walk through the finer points:

Enable and Mount the Guest Additions CD

Switch to the console window of the running virtual machine and select Install Guest Additions from the Devices menu, as shown. Note: Nothing will appear to happen, when you do this.

Enable VirtualBox Guest Additions CD

Next, we verify that VirtualBox has actually loaded the CD into the drive, by looking at Devices -> CD/DVD devices -> VBoxGuestAdditions.iso. The entry should have a check-mark next to it, indicating that it is succefully loaded, as shown in the screenshot. Note that this can sometimes fail if you have a badly configured drive or something similar wrong, in your setup. Usually VirtualBox will prompt you with an alert when such a failure happens.

Verify VirtualBox Guest Additions CD is loaded

Install the build dependencies

Right, now for the tricky parts. :)

First, we need to install the development dependencies of the VirtualBox guest additions kernel modules. To do that, you have to first determine what kernel version you're using. We usually combine all of this into a single apt-get command, like so. First, become root with the su command and type your root password. Then run:
apt-get install build-essential linux-headers-`uname -r`
Note: The reverse quotes in above command are not a typo - we're taking the output of one command and replacing it into our main command.

Mounting the Virtualbox guest additions CD, manually

If you were running in X Windows, the Virtualbox guest additions CD would typically get auto-mounted and you would proceed to directly run the shell script. Not so, when you're running headless (at least with the default setup). So you have to manually mount the cdrom device, at /media/cdrom, with the following command:

mount /dev/cdrom /media/cdrom

and then cd to the mounted directory and see the files, you should see something like this in your console:

dkgLennyi386:/home/dhiraj/svn/odn/cynintrunk# cd /media/cdrom
dkgLennyi386:/media/cdrom# ls -lh
total 30M
dr-xr-xr-x 3 root root 2.0K 2009-12-17 19:07 32Bit
dr-xr-xr-x 2 root root 2.0K 2009-12-17 19:07 64Bit
-r-xr-xr-x 1 root root  217 2009-12-04 15:36 AUTORUN.INF
-r-xr-xr-x 1 root root 4.4K 2009-12-17 19:03
-r-xr-xr-x 1 root root 2.8M 2009-12-17 18:59
-r-xr-xr-x 1 root root 2.4M 2009-12-17 19:06
-r-xr-xr-x 1 root root  13M 2009-12-17 17:54 VBoxSolarisAdditions.pkg
-r-xr-xr-x 1 root root 5.9M 2009-12-17 18:54 VBoxWindowsAdditions-amd64.exe
-r-xr-xr-x 1 root root 467K 2009-12-17 18:51 VBoxWindowsAdditions.exe
-r-xr-xr-x 1 root root 5.3M 2009-12-17 18:52 VBoxWindowsAdditions-x86.exe

Run the installation shell script from CD

All that's remaining now is the running of the installer script. You will typically want to run, like this:


The shell script should now proceed to build the guest additions and will usually complain that there's no X Server found, or about no OpenGL support and so on, all this is normal in our case. When it completes, you can see if you get a noticeable performance boost by restarting your virtual machine using the reboot command or whatever other restart mechanism you're happy with. Restarting is required. Also, every time you install a kernel upgrade, you'll have to repeat the above procedure, because the VirtualBox guest additions kernel modules will no longer be in sync with the current kernel and thus, not load.

Quick step how-to for installing VirtualBox Guest Additions on development environment. This is mostly useful only for developers running buildout from source on a Debian / Ubuntu / running inside a VirtualBox on a host operating system like Windows or Mac.
Comments (19)
domderrien Mar 31, 2010 10:52 PM
The first command mentions"
"Package linux-headers is not installed, so not removed"
"E Couldn't find package 2.6.26-2-686"

When I run the VBox utility, I got:
"(Your system does not seam to be set up to build kernel modules."
"Look at /var/log/vboxadd-install.log to find out what went wrong)"
"Installing the Window System drivers!"
"(Could not find the X.Org or XFree86 Window System.)"
dhiraj Apr 01, 2010 10:30 PM
You typed a space between linux-headers- and `uname -r` (probably because you did not read the warning below the command).

That made linux think that you wanted to install 2 things, whereas the command actually installs only 1. Please copy paste the command from the instructions instead of typing it and it will work.

To *be able* to copy paste, you will probably have to SSH into the appliance in the first place (using a client like putty if you're on windows).
domderrien Apr 01, 2010 10:57 PM
Good catch Dhiraj!

Because of the text in italic, I thought a space was inserted between the dash and the back-quote. I'm going to repeat it soon.

Thanks, Dom
domderrien Mar 31, 2010 10:54 PM
After the successful install, I just have access to a command prompt. I have not seen which graphical interface is available. Any hint?

What the benefits of installing the VBox extensions?
viraf Apr 01, 2010 08:39 AM
you need to determine the IP address of your newly installed system, then point your web browser to it and use the default administrator credentials to access the system

ps: default admin credentials are

Happy Evaluating !!
domderrien Apr 01, 2010 04:00 PM
Thanks Viraf.

The evaluation is going well. Currently playing with the WebDAV feature ;)

Any response about why we need to install the VBox extensions? The Cynin setup works fine just from the command line, so no Graphical Interface is required on the server box (real server or just the VM). Do the VBox kernel patches make a difference?

A+, Dom
dhiraj Apr 01, 2010 10:24 PM
Guest Additions in VirtualBox are basically kernel-mode drivers for the operating system that's running in it. This includes drivers for at least disk I/O and networking and also helps out with the virtualized CPU, I think. Having these installed improves efficiency with the virtualized hardware resources so your whole system runs faster.

This is true for any virtualization tech that you're using, actually. VMWare have their own "tools" that you can install as well.

So while you're probably used to installing guest additions only for the obvious UI benefits (auto resizing guest screen resolutions, copy paste), there are performance merits as well. The problem is that you have to (manually, using above instructions) keep the guest additions updated to match your linux kernel version as well.
domderrien Apr 01, 2010 10:59 PM
Thanks for the explanations. Up to now, the system in VBox acts pretty well. If the installation VBox extensions (should do it by correcting the typo you pointed above), it should go even better!
nourse Jun 03, 2010 06:20 PM
I've run into the following issue, using the latest community edition appliance:

cynin:/# apt-get install build-essential linux-headers-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package build-essential is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package build-essential has no installation candidate

I was able to install the vbox additions, but it fails to load on boot "(modprobe vboxguest failed)...."

Any ideas on what might be going on?
dhiraj Jun 14, 2010 10:54 AM
@nourse: What OS are you on? build-essential is available on both Debian and Ubuntu. The instructions for other distros will possibly be radically different.
chrisfield Oct 12, 2010 06:55 PM
I'm having trouble installing the linux headers. When I run apt-get install linux-headers-2.6.26-2-686 I get an error "Some packages caould not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The folowing infformation may help to resolve the situation: Linux-headers-2.6.26-2-686: Depends: linux-kbuild-2.6.26 but it is not installable Depends: gcc-4.1 but it is not installable. Can anyone hlep? "
fernkb2 Feb 16, 2011 09:28 AM
same problem with chrisfield using the latest community edition. Any Solution?
dhiraj Feb 16, 2011 09:38 AM
chrisfield, @fernkb2: Is this happening on a Community Edition ISO built machine? Or is this on a standard linux distro? Please tell us your distro and version, if so.
fernkb2 Feb 21, 2011 10:12 AM
@dhiraj: You are right. This is happening on a latest Community Edition ISO. Any solution? We love and we are currently evaluating it. Please help.
fernkb2 Mar 09, 2011 08:34 AM
@dhiraj: Any updates on this one? The problem still persists as stated above by @Chrisfield
dhiraj Mar 29, 2011 01:38 PM
Hmm... requires some apt-cache / apt-get investigation using depends / rdepends. The problem is possibly missing dependencies for updated kernels / build essentials etc. The worst case scenario would require comparing and adding changed or missing apt-get repositories from the standard Debian 5.0 lenny distro.
woiski May 01, 2011 11:47 PM
I acknowledge exactly the same problem here!
woiski May 13, 2011 03:06 AM
1- add deb lenny main contrib non-free to /etc/apt/sources.list
2- aptitude update
3- follow dhiraj's instructions, except that I my case I had to use /dev/cdrom1 /media/cdrom
4- restart and.. you can verify that GuestAdditions is installed!