Please login to participate.
Wiki Page

Install VirtualBox Guest Additions

.

A quick note on Virtualization

For people who do not want to or are unable run Cyn.in 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 Cyn.in developers, I recommend usage of Sun's VirtualBox. VirtualBox provides the maximum simplicity + 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 Cyn.in 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 Cyn.in 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 autorun.sh
-r-xr-xr-x 1 root root 2.8M 2009-12-17 18:59 VBoxLinuxAdditions-amd64.run
-r-xr-xr-x 1 root root 2.4M 2009-12-17 19:06 VBoxLinuxAdditions-x86.run
-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 VBoxLinuxAdditions.x86.run, like this:

./VBoxLinuxAdditions-x86.run

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.

Description
Quick step how-to for installing VirtualBox Guest Additions on Cyn.in development environment. This is mostly useful only for developers running buildout from source on a Debian / Ubuntu / Cyn.in running inside a VirtualBox on a host operating system like Windows or Mac.
Comments (0)
 
Loading