Lenny: VirtualBox 1.6.6 & current kernel 2.6.29

Debian is one of the best Linux distros out there (if not the best). The latest stable version called Lenny was released about a month ago, but as always, Debian never ships the latest software or kernel versions. So I decided to install the latest vanilla kernel (2.6.29) from kernel.org (I might provide a howto for this task later… 😉 ). This work’s really great – most of the time… I ran into one problem installing Debians (rather old) VirtualBox OSE 1.6.6 though. As I don’t run Debians kernel I needed to compile a suitable kernel module for my kernel 2.6.29 using Debians module-assistant. But compiling the module bailed out with errors: ‘struct task_struct’ has no member named ‘euid’. Luckily I found a solution for VirtualBox 2.10 on VirtualBox Forums. Of course the provided patch didn’t work for VirtualBox 1.6.6 but from there on it was easy to build one. If you run into the same problem, well, this is how it worked for me:

Install virtualbox-ose-source and module-assistant:

su -c "apt-get install virtualbox-ose-source module-assistant"

Then switch as root to /usr/src and unpack “virtualbox-ose.tar.bz2”

cd /usr/src
tar xvf virtualbox-ose.tar.bz2

This will create a new subdirectory “modules” where the source code of the VirtualBox module can be found. We need to patch module/virtualbox-ose/linux/SUPDrv-linux.c now.

Download my patch for VirtualBox 1.6.6 from here and then invoke

cd /usr/src/modules/virtualbox-ose/linux
patch SUPDrv-linux.c < /path/to/vbox-ose.patch

Now go back to /usr/src and rename the source package because we’ll create a new one now (make sure no other module source code resides within the modules directory – if so, just move it out of the way temporarily):

cd /usr/src
mv virtualbox-ose.tar.bz2 virtualbox-ose_bak.tar.bz2
tar cvf virtualbox-ose.tar modules
bzip2 virtualbox-ose.tar

This is basically it. You can now build the module by

m-a prepare
m-a a-i virtualbox-ose

This should build and install a working virtualbox kernel module!