VirtualBox OSE: can't find kernel driver, run modprobe vboxdrv

strict warning: Only variables should be passed by reference in /mnt/volume-sfo2-01/www/ on line 559.

I got a message to run modprobe vboxdrv, but didn't seem to have the vboxdrv driver.

It turned out that the vboxdrv.ko object existed (turned up by doing a "locate vboxdrv"), but not for my current kernel. The solution was to rebuild the driver for my kernel. To find out what kernel I had:

uname -r

If you don't have the vbox drivers, install them:

sudo apt-get install virtualbox-ose-dkms

The vbox drivers are build using DKMS, which is a driver framework. (It allows drivers to be built apart from the kernel, so the drivers are standalone, somewhat like they are with Windows.) Normally, the apt-get program will rebuild the drivers automatically, but if the kernel headers are not installed, they will not get rebuilt.

So, check to make sure your kernel headers are installed.

ls /usr/src

If you don't see a directory corresponding to the kernel version number, you need to install the linux-headers package from apt-get.

sudo apt-get install kernel-header

Run that, and you might get a list of potential headers packages to install. Choose the one that matches your kernel version, and install it. Example:

sudo apt-get install linux-headers-2.6.32-24-server

Installing a new kernel should trigger a rebuild of all the dkms-based drivers.

If the headers are already installed, add the --reinstall flag:

sudo apt-get --reinstall install linux-headers-2.6.32-24-server

Then, start up the virtualbox-ose service (which loads up the drivers):

sudo /etc/init.d/virtualbox-ose start