Installing VirtualBox OSE 2.1 on Kubuntu 8.10 Intrepid Ibex

VirtualBox 2.1 was recently released, and Debian Experimental and Ubuntu Jaunty now have builds available for it. However, as Jaunty is not yet released, and VirtualBox 2.1 offers some quite useful advantages over 2.0, you may be inclined to try to get it on your Intrepid box. While there are packages from Sun compiled for Intrepid, they are licenced under the VirtualBox Personal Use and Evaluation Licence, so if you're like me, you need to use the VirtualBox OSE 2.1 release instead. Here's the rundown of what finally worked for me.

The first thing you might think to try is to just download the Jaunty debs, and try to install them manually using dpkg. For many packages, this might work, especially ones which have few forward and/or reverse dependencies. (In fact, we do exactly this with kBuild below...) Unfortunately, there's one dependency which is not available in this case - the Jaunty VirtualBox OSE build depends on libcap2 >= 2.11, and Intrepid bundles libcap2 2.10, so dpkg will quit with an error message.

What works is to rebuild the package from source, and instructions for that are what follows. It's not really hard, everything has been automated anyway for the build system, so we just install a local copy of the build-system and off we go...

First, we install some necessary build-dependencies. (I don't know if this list is complete, or minimal, only that it worked for me.)

user@host:~$ sudo apt-get update
user@host:~$ sudo apt-get install bcc bin86 build-essential debhelper \
                docbook-xml docbook-xsl dpatch dpkg-dev g++ g++-4.2 gcc \
                gcc-4.2 iasl libacl1-dev libasound2-dev libasound-dev \
                libcap2-dev libcap-dev libhal-dev libidl-dev libpng12-dev \
                libpulse-dev libqt4-dev libsdl1.2-dev libstdc++5 libx11-dev \
                libxcursor-dev libxext-dev libxi-dev libxml2-dev libxmu-dev \
                libxrender-dev libxslt1-dev lynx po-debconf python2.5-dev \
                python-dev qt4-dev-tools uuid-dev xsltproc yasm zlib1g-dev

Then, we make a temp directory to work in...

user@host:~$ mkdir /tmp/builddir
user@host:~$ cd /tmp/builddir

Now, we retrieve the necessary files from the Jaunty repository. We need to know the location of your nearest Ubuntu Jaunty mirror. You can use the value currently configured into your /etc/apt/sources.list, as long as it has been updated to include Jaunty. This url should have a "pool" subdirectory.

user@host:/tmp/builddir$ YOUR_LOCAL_UBUNTU_MIRROR=
user@host:/tmp/builddir$ wget $YOUR_LOCAL_UBUNTU_MIRROR/pool/universe/k/kbuild/kbuild_0.1.5svn2062-1_i386.deb
user@host:/tmp/builddir$ wget $YOUR_LOCAL_UBUNTU_MIRROR/pool/universe/v/virtualbox-ose/virtualbox-ose_2.1.0-dfsg.orig.tar.gz 
user@host:/tmp/builddir$ wget $YOUR_LOCAL_UBUNTU_MIRROR/pool/universe/v/virtualbox-ose/virtualbox-ose_2.1.0-dfsg-1ubuntu2.dsc 
user@host:/tmp/builddir$ wget $YOUR_LOCAL_UBUNTU_MIRROR/pool/universe/v/virtualbox-ose/virtualbox-ose_2.1.0-dfsg-1ubuntu2.diff.gz

One build dependency we didn't install above was kbuild. That's because VirtualBox OSE 2.1 requires a newer version of kbuild than is available in Intrepid, so we install the one from Jaunty. kbuild has no depends or rdepends other than libc6, so we should be okay. (All I can say is that it worked for me, and nothing seems broken...)

user@host:/tmp/builddir$ sudo dpkg -i /tmp/builddir/kbuild_0.1.5svn2062-1_i386.deb

Now, we unpack the source, apply all the ubuntu-specific patches, configure and build it. All that has been automated - dpkg-source will do the first two steps, and dpkg-buildpackage will do the latter two.

user@host:/tmp/builddir$ dpkg-source -x virtualbox-ose_2.1.0-dfsg-1ubuntu2.dsc
user@host:/tmp/builddir$ cd virtualbox-ose-2.1.0-dfsg/
user@host:/tmp/builddir$ dpkg-buildpackage -rfakeroot -b
user@host:/tmp/builddir$ cd ..

Now, install our freshly built packages, and away we go!

user@host:/tmp/builddir$ sudo dpkg -i /tmp/builddir/virtualbox-ose-source_2.1.0-dfsg-1ubuntu2_all.deb \