VirtualBox Guest Extension Dependencies 3

Posted by JD 07/05/2012 at 16:00

Every few months, I decide to install a newer version of Oracle’s VirtualBox on my laptop. Usually, this is really easy and everything goes well. Whenever I load up a new clientOS, I have to remember all the dependencies required to get the guest additions to compile and link. I always forget something or end up doing it a less-than-perfect way.

New Desktop OS

About a month ago, I switched to using Ubuntu Srv 12.04 with LXDE environment. This was a fresh OS load, not an upgrade, so I had to figure out which dependencies were needed … again. It appears I didn’t do it the best way.

Problem Discovery

The way I discovered the problem was after a kernel update, the mouse stopped working well, the desktop resolution was wrong (very low) and a mount using the vboxsf driver for the hostOS didn’t work. It was a bad day here. Multiple attempts using


sudo mount -t vboxsf D /Data

all failed with a less than useful error. It was only when I looked for the vboxsf kernel module and did not fine it, that I knew what the underlying problem was.

I need to add an warning to my mount script for this module. Perhaps this script will work added to the /etc/rc.local?


if [ ! -d /Data/temp ] ; then
GOT=`lsmod | grep -c vboxsf`
if [ 0 -eq $GOT ] ; then
echo “ERROR – vboxfs kernel module not loaded – new guest additions needed?”
else
echo "Mounting vboxfs …$GOT "
mount -t vboxsf D /Data
fi
fi

The Fix – Missing Headers

$ sudo apt-get install linux-headers-generic-pae

I’d used the specific headers for the exact kernel instead of this meta-package. The meta-package is better, since any kernel upgrade will include new headers and we need those.

Lazy

As you can see, I’ve been lazy twice today.

  1. installing the meta-package so I don’t need to remember to install the specific Linux Kernel headers anymore
  2. wrote a tiny script to check for a common problem and forced it to run during every boot sequence.

For any administrator, lazy is good.

  1. Mhara 08/11/2012 at 11:07

    ..or you can install samba to aeccss your virtual env directories.How much ram your virtual env use (with virtual box)?I tried vm fusion and Parallels. Parallels uses only 140-200mb versus fusion ~500mb.

  2. JD 08/12/2012 at 13:35

    VMware Fusion performance is much better than VirtualBox.

    Ok, the actual title of that article was VMware Fusion Stuns VirtualBox In CPU Tests, but that seemed too much like a fanboi to link. I am not a fan of anything from Apple. Sorry.

    Most of the benchmark results were close. I saw that graphics intensive items were better on Fusion and Apache on Fusion blew away VirtualBox. It was so different that the test configuration really needs to be looked at carefully to ensure nothing was misconfigured.

    I think VMware-Fusion is normally $100 and works only on OSX, but older versions can be found for $20-$30 sometimes. VirtualBox is GPL code and runs on many different platforms. Moving virtual machines between these platforms is possible.

  3. JD 08/28/2012 at 13:17

    To load the Guest Addition dependencies, start with:
    $ sudo apt-get install build-essential

    Then run uname -r to determine which kernel type is installed. Headers for your running kernel are needed.

    • {something}-generic-pae = sudo apt-get install linux-headers-generic-pae
    • {something}-generic = sudo apt-get install linux-headers-generic
    • {something}-server = sudo apt-get install linux-headers-server

    Only 1 of needs to be installed.