Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am getting this error "Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop." What is this error and how to fix it?

enter image description here

enter image description here

share|improve this question
add comment

3 Answers

Make sure you install Kernel Headers Package.

http://www.cyberciti.biz/faq/howto-install-kernel-headers-package

Make sure you have updated version

Type the following command
$ sudo apt-get update

OR as root user enter:
# apt-get update

Search for kernel version (optional)

Type the following command:
$ apt-cache search linux-headers-$(uname -r)

Install linux-header package under Debina or Ubuntu Linux

Type the following command:
$ sudo apt-get install linux-headers-$(uname -r)

OR as root user:
# apt-get install linux-headers-$(uname -r)

EDIT:

I just happen to need to install it also on my own server and got the same error when trying to use the virtualbox in debian repos. I went ahead and added VirtualBox repo and installed from there. This is better because they are more up-to-date.

As root

$ nano /etc/apt/sources.list 

Add line below for squeeze

deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free

Then add the The Oracle public key for apt-secure

$ wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

then run update and to install latest 4.2

apt-get update
apt-get install virtualbox-4.2

Install the dkms package to ensure that the VirtualBox host kernel modules are up to date

apt-get install dkms

Should be good to go. Got these instructions from VirtualBox's website for Linux which seems to be down at the moment but the link is https://www.virtualbox.org/wiki/Linux_Downloads

share|improve this answer
    
The command apt-cache search linux-headers-$(uname -r) returns nothing for me even though I did the above commands. –  hhh Nov 3 '12 at 22:12
    
@hhh I think this answer is good one, and should be accepted. I do not know what you want with this **linux-headers-$(uname -r) **. Please, explain or open a new question. I think this thread is finished. –  Masi Nov 20 '13 at 15:37
add comment

@hhh You should search only for linux-headers and find the good one for your architecture. In my case:

# aptitude search linux-headers      
v   linux-headers                                                       -                                                                              
p   linux-headers-2.6-amd64                                             - Header files for Linux amd64 configuration (dummy package)                   
p   linux-headers-3.2.0-4-all                                           - All header files for Linux 3.2 (meta-package)                                
p   linux-headers-3.2.0-4-all-amd64                                     - All header files for Linux 3.2 (meta-package)                                
i A linux-headers-3.2.0-4-amd64                                         - Header files for Linux 3.2.0-4-amd64                                         
i A linux-headers-3.2.0-4-common                                        - Common header files for Linux 3.2.0-4                                        
p   linux-headers-3.2.0-4-common-rt                                     - Common header files for Linux 3.2.0-4-rt                                     
p   linux-headers-3.2.0-4-rt-amd64                                      - Header files for Linux 3.2.0-4-rt-amd64                                      
i   linux-headers-amd64                                                 - Header files for Linux amd64 configuration (meta-package)                    
p   linux-headers-rt-amd64                                              - Header files for Linux rt-amd64 configuration (meta-package)

So, in my case, I have an 64-bit architecture, I have to install linux-headers-amd64.

Another thing is apt-get add does not exist. Replace apt-get by apt-key.

share|improve this answer
add comment

Try:

yum install kernel* dkms gcc

Then

yum install kernel-uek-devel

Then reboot your machine

share|improve this answer
    
Debian uses apt-get, not yum. –  RobinJ Jun 9 at 13:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.