Archive for February 16th, 2011

Running VirtualBox on Ubuntu 11.04 Natty alpha

I’m using the current Ubuntu alpha – 11.04 as my desktop OS on my laptop, and on the same laptop I sometimes need to run VirtualBox to access an MS-Windows environment.

In the current Natty alpha this doesn’t work well. I have VirtualBox 4.0 installed from Oracle’s repository, but it doesn’t manage to compile the kernel module it needs – probably because of the “RC” nature of the current Natty’s kernel (2.6.38-rc4) as of this writing.

I’ve seen many posts on the internet about running Ubuntu 11.04 as a guest in VirtualBox, but couldn’t find anyone talking about my problem, which is the opposite – running VirtualBox on Ubuntu 11.04. So here’s how to get this thing working:

  1. Install VirtualBox 4.0 (from Oracle’s repository)
  2. Install the kernel headers package for Ubuntu: sudo apt-get install linux-headers
  3. Edit the headers’ Makefile to declare the same version as the uname command: run uname -r and note the suffix after the version number, for example mine says “2.6.38-3-generic“, so I am interested in “-3-generic“. Edit the Makefile using sudo gedit /usr/src/linux-headers-<version>-3-generic/Makefile , and the fourth line should say something like “EXTRAVERSION = -rc4“. Change the value (in this case “-rc4“) to what you found out from uname.
  4. add autoconf.h to the linux include directory, because it is missing for some reason:
    cd /usr/src/linux-headers-<version>-3-generic/include/linux
    sudo ln -s ../generated/autoconf.h

Now you can run sudo /etc/init.d/vboxdrv setup and it should complete successfuly and allow you to start VirtualBox.

Enhanced by Zemanta