Ubuntu – Unable to install VirtualBox on Ubuntu 12.10: Kernel headers cannot be found

virtualbox

I'm trying to install Virtualbox on Ubuntu 12.10 64bit, (Kernel 3.5.0-23). I've already installed dkms, build-essential, linux-source, linux-kernel-headers, … . I still get this error:

Error! Your kernel headers for kernel 3.5.0-23-generic cannot be found.
Please install the linux-headers-3.5.0-23-generic package,
or use the –kernelsourcedir option to tell DKMS where it's located

The kernel headers and source are in their appropriate place:

ls /usr/src
linux-headers-3.5.0-23          linux-source-3.5.0
linux-headers-3.5.0-24          linux-source-3.5.0.tar.bz2
linux-headers-3.5.0-24-generic

I know there are tons of similar questions on different forums, I've tried all of them. None of them works. Can anyone help me please?

Best Answer

Install the kernel headers for your system by running this command in your terminal (Ctrl+Alt+T):

sudo apt-get install linux-headers-$(uname -r)