# NVIDIA installer cannot find kernel.h (Solved)

## helio

After a recent emerge my NVIDIA driver stopped working due to ABI conflict with the xorg-server-1.8.4. So I have been trying to install a new version of NVIDIA driver using the NVIDIA intaller NVIDIA-Linux-x86_64-367.44.run. Then I got into trouble when the installer couldn't find the kernel.h:

  ERROR: The kernel header file '/lib/modules/3.17.7-gentoo/source/include/linux/kernel.h' does not exist.  The most likely       

         reason for this is that the kernel source path '/lib/modules/3.17.7-gentoo/source' is incorrect.  Please make sure you   

         have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems,  

         for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed.  If you know the correct kernel       

         source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.  

Any suggestions are appreciated.Last edited by helio on Tue Sep 20, 2016 1:59 pm; edited 1 time in total

----------

## Buffoon

nVidia driver up to version 370.28 is in portage, why manual inastall?

```
* x11-drivers/nvidia-drivers

     Available versions:  [M]96.43.23-r1(0/96)^msd [M]173.14.39-r1(0/173)^msd 304.131(0/304)^msd (~)304.131-r1(0/304)^msd (~)304.131-r4(0/304)^md 340.93-r1(0/340)^msd 340.96(0/340)^msd (~)340.96-r5(0/340)^md [m]346.96-r1(0/346)^msd [m](~)346.96-r6(0/346)^md [m]352.63(0/352)^msd [m]352.79(0/352)^msd [m](~)352.79-r4(0/352)^md [m](~)355.00.27(0/355.00)^fmd [m]355.11-r2(0/355)^msd [m](~)355.11-r4(0/355)^md [m]358.16-r1(0/358)^msd [m](~)358.16-r5(0/358)^md [m]361.28(0/361)^msd [m](~)361.28-r2(0/361)^md [m](~)361.42(0/361)^md [m](~)361.45.11(0/361.45)^md [m](~)361.45.18(0/361.45)^md [m](~)364.12-r1(0/364)^md [m](~)364.15(0/364)^md [m](~)364.19(0/364)^md [m](~)367.18(0/367)^md [m](~)367.27(0/367)^md [m](~)367.35-r1(0/367)^md [m](~)367.44(0/367)^md [m](~)370.28(0/370)^md {+X acpi compat custom-cflags +driver gtk gtk2 gtk3 +kms multilib pax_kernel static-libs (+)tools uvm wayland KERNEL="FreeBSD linux"}

 
```

OTOH your kernel is outdated.

----------

## helio

At certain point in the past, the x11 version of nvidia driver didn't seem to work. Anyway, I couldn't get it emerged either

>>> Emerging (6 of 6) x11-drivers/nvidia-drivers-361.28::gentoo

 * Fetching files in the background.

 * To view fetch progress, run in another terminal:

 * tail -f /var/log/emerge-fetch.log

 * NVIDIA-Linux-x86_64-361.28.run SHA256 SHA512 WHIRLPOOL size  :Wink:  ...                                                      [ ok ]

 * nvidia-settings-361.28.tar.bz2 SHA256 SHA512 WHIRLPOOL size  :Wink:  ...                                                      [ ok ]

 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Could not find a Makefile in the kernel source directory.

 * Please ensure that /usr/src/linux points to a complete set of Linux sources

 * Unable to calculate Linux Kernel version for build, attempting to use running version

 * Could not find a usable .config in the kernel source directory.

 * Please ensure that /usr/src/linux points to a configured set of Linux sources.

 * If you are using KBUILD_OUTPUT, please set the environment var so that

 * it points to the necessary object directory so that it might find .config.

 * ERROR: x11-drivers/nvidia-drivers-361.28::gentoo failed (setup phase):

 *   Kernel not configured; no .config found in

----------

## xaviermiller

does the /usr/src/linux symbolic link point to an active Linux kernel tree?

It seems the link points to a uninstalled version (there remain only .o, not the Makefile).

----------

## helio

 *xaviermiller wrote:*   

> does the /usr/src/linux symbolic link point to an active Linux kernel tree?
> 
> It seems the link points to a uninstalled version (there remain only .o, not the Makefile).

 

Well in /usr/src/linux the kernel.h was missing. Following the suggestion from the first response, I installed the latest kernel. Then I was able to install the latest nvidia proprietary driver. Finally X is working again, even though some of the problems reported earlier still remain (but probably don't matter for now).

Thanks for all the responses.

----------

