1

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.

1
  • 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. Aug 14, 2013 at 10:14

1 Answer 1

1

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.

2
  • What's the diffrence between apt-get source linux-image-xxx versus apt-get install linux-source-xxx ?
    – mveroone
    Aug 14, 2013 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, 2013 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .