Install/Upgrade VirtualBox Guest Additions on Backtrack 5 R2

The last three times I upgraded the VirtualBox Guest Additions on my Backtrack box, they have not installed completely and cleanly. My guess is this has to do with lack of kernel 3.x support from VirtualBox that I’m sure they will add eventually, as I believe Backtrack with kernel 2.6 worked fine.

The error I consistently receive during the Guest Additions installation is:

Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...fail!

Some of the install succeeds, however, as the appropriate files are added in /etc/init.d and otherwise. Just the kernel modules that don’t work. No big deal, don’t need those anyways… Right.

The part that I noticed was missing that I need the most is desktop resolution automatically changing when the VM window changes size. Here are the steps I followed to get it to work again. I’m sure there is a quicker way to do this, but this worked for me.

  1. First, install linux-source which is your kernel source compressed and uncompiled. Also install linux-headers, your kernel headers.
    apt-get install linux-source linux-headers
  2. Next, extract the tar file and compile the kernel.
    cd /usr/src
    tar xf linux-source-3.2.6.tar  #or whatever kernel version you are running
    cd linux-source-3.2.6
    make oldconfig
    make prepare
    make -j3
  3. Go take a break. Go outside, read a book, go for a run. This could take a while (on my slow 1.6ghz dual core, it took approximately 4 hours).
  4. Then initiate the Guest Additions installation and change to the directory where it was mounted, in my case /media/VBOXADDITIONS_4.1.14_77440/. Your directory may be different for a different version of VirtualBox.
  5. Run the linux installer with the flags to extract and keep the installation source to a location of your choosing, in my case /tmp/vbox. The run will fail due to the kernel module not building, but everything else that is needed will install.
    ./VBoxLinuxAdditions.run --keep --target /tmp/vbox
  6. Next, extract the Guest Additions for your architecture and compile them with the path to your kernel source specified. Otherwise, it won’t find the source. Lastly, modprobe the module and reboot.
    cd /tmp/vbox
    bunzip2 VBoxGuestAdditions-amd64.tar.bz2
    tar xf VBoxGuestAdditions-amd64.tar
    cd src/vboxguest-4.1.14  # again, adjust the path to the version of VirtualBox you have installed
    make KERN_DIR=/usr/src/linux-source-3.2.6
    make install KERN_DIR=/usr/src/linux-source-3.2.6
    modprobe vboxguest
    reboot
  7. PROFIT.

Your VirtualBox Guest Additions should now be fully functional.

One thought on “Install/Upgrade VirtualBox Guest Additions on Backtrack 5 R2”

  1. Amazing one week of installs and reading websites and all i needed was this you are a star 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *