Missing Kernel Source when Installing VirtualBox

I'm creating a virtual machine to use for my upcoming training courses to get around issues trying to get machines set up in a hurry on the day. I haven't used VirtualBox before but since it has free clients for Windows/Mac/Linux I thought I'd give it a go.

I found that when I tried to install the virtualbox package through aptitude, I got this error:

First Installation: checking all kernels...
Building only for 3.0.0-12-generic-pae
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

Closer inspection showed that although I had the generic headers for this kernel, I didn't have the pae version (I only upgraded this machine a couple of days ago which doesn't help). To add the headers I needed, I simply did:

sudo aptitude install linux-headers-3.0.0-12-generic-pae

I was then able to install virtualbox successfully, and create a shiny new Xubuntu VM for my course attendees to use later in the month.

5 thoughts on “Missing Kernel Source when Installing VirtualBox

  1. Thanks a lot. I tried installing the 'linux-headers' package and it did not work. I then realized that you had used 'linux-headers-generic' package. Cheers.

  2. Thank you for this! I was getting a "AdditionsVBoxService error: VbglR3Init failed with rc=VERR_FILE_NOT_FOUND" after upgrading from Debian 6 to 7. Installing the linux-headers for the new 686-pae kernel, reinstalling virtualbox-guest-utils, and then restarting resolved my problem.

    Hopefully this info will help others who run into a similar problem.

  3. debian / ubuntu can have several kernels, with or without source. obviously only one is running (or "booted to") at any given time, but the each may have or not have their headers for module builds.

    apt-get install linux-headers-`uname -r`

    will at least install the headers for the current kernel you are running.
    those are "backticks" around...
    uname -r
    ... in case this form eats them.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>