8

I have installed vitualbox on Debian Jessie according to instructions on debian wiki.
By running:

apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox

During installation some errors were reported.
Now I want to re-configure virtualbox-dkms but I receive this error:

Loading new virtualbox-4.3.18 DKMS files...
Building only for 3.16-3-amd64
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

Note: uname -r shows 3.16-3-amd64 but my source folder in /usr/src is named:
linux-headers-3.16.0-4-amd64.

I don't know what to do!

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Mahdi
  • 271
  • 1
  • 3
  • 9

2 Answers2

13

Run:

$ sudo apt-get update
$ sudo apt-get install linux-headers-`uname -r`

If that second command still fails to find anything, then:

$ apt-cache search linux-headers-

to list all the linux-headers packages available.

At least one should match the kernel you are running (as displayed by uname -r).

Then:

sudo apt-get install linux-headers-<version number>
garethTheRed
  • 33,289
  • 4
  • 92
  • 101
3

I did all of these solutions but problem was about my kernel!

linux-headers-uname -r wanted to install 3.16.0-3 headers due to my kernel version but there is no such linux kernel header in Debian repos: There is 3.16.0-4

Solution: upgrade my kernel via apt-get then everything works fine.

Mahdi
  • 271
  • 1
  • 3
  • 9