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 downloaded the source code of a driver (tun 1.1) and i was planning to installing when i obtained the following error:

root@sergiosaturn-HP-Pavilion-dv6500-Notebook-PC:~/Documentos/Tese/tun-1.1# ./configure
loading cache ./config.cache
checking host system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gawk... (cached) mawk
checking for a BSD compatible install... (cached) /usr/bin/install -c
creating ./config.status
creating Makefile
configuring in linux
running /bin/sh ./configure  --cache-file=.././config.cache --srcdir=.
loading cache .././config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for kgcc... gcc
checking for gawk... (cached) mawk
checking for a BSD compatible install... (cached) /usr/bin/install -c
configure: error: Linux kernel source not found in /usr/src/linux 
configure: error: ./configure failed for linux

In order to solve this problem i have used the following commands:

apt-get source linux-image-$(uname -r)

make oldconfig

make

This not only did not solve my problem, but also destroyed my ubuntu installation. I was forced to save my files and re-install ubuntu all over again. If anyone knows how to solve this problem, could you please help me.

Thank you for your time.

share|improve this question
    
The only way that could have "destroyed" your install is if you ran make install. In addition the worst you could have done was replace your kernel (and your modules if you ran make modules) but ubuntu does keep old kernels around and even distros that don't, can be repaired by chrooting from within a livecd. –  justbrowsing Aug 14 '13 at 10:14
add comment

1 Answer

You are missing the kernel sources, not the kernel image (which you already have, because you booted it).

Try apt-cache search kernel | grep source to see a list of likely candidates. It's linux-source for me, but it might be called otherwise on your distro. Also see that the version matches the one you are using right now.

Using apt-get source should give you the right source code too, as pointed out correctly in the comments.

Btw.: if the driver needs the kernel sources (and not just the headers), it seems like it will not be build as a module but compiled directly into the kernel. This means you have to compile and install the whole kernel (and do this again every time your kernel would otherwise be automatically updated). You should only do that if you know exactly what you are doing and the driver is worth the effort. Almost all common drivers are available as a module and should therefore not need the kernel sources (but just the headers) to build.

share|improve this answer
    
What's the diffrence between apt-get source linux-image-xxx versus apt-get install linux-source-xxx ? –  Kwaio Aug 14 '13 at 12:12
    
I'm sorry, my bad. I've totally overlooked the use of apt-get source instead of apt-get install. I'll correct the answer. –  Chaos_99 Aug 14 '13 at 12:33
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.