Installer: --add-this-kernel for kernel that is not currently running fails

I use a custom linux kernel and use the --add-this-kernel option of the installer to create an installer that includes the kernel module for this particular kernel.

Everything works fine when I build the custom installer on a machine that runs the same kernel as the destination machine:

bash NVIDIA-Linux-x86_64-331.20.run -s --add-this-kernel --kernel-source-path=/path/to/kernel/source/tree

If I want to add a kernel that is not currently running, the README file in the installer package suggests how to do it:

This will unpack ‘NVIDIA-Linux-x86_64-331.67.run’, compile a kernel
interface layer for the currently running kernel (use the --kernel-source-path
and --kernel-output-path options to specify a target kernel other than the
currently running one)
, and create a new installer package with the kernel
interface layer added.

If I don’t use a separate output directory for the kernel build, the kernel output path coincides with the kernel source path, and the NVIDIA installer knows this (help for --kernel-output-path says: When not specified, the installer will assume that no separate output directory was used).

So, the above execution line for the NVIDIA installer should also work if the kernel is not running. As a matter of fact, it’s not – the error message when I try to install the *-custom.run package on a machine running the kernel given by --kernel-source-path is the usual

[i]ERROR: Unable to find the kernel source tree for the currently running kernel. 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.

ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.[/i]

When I extract the -custom.run installer created by above command using -x, the file ./kernel/precompiled/nvidia-precompiled-331.20. contains the name of the running kernel (instead of the kernel I specified using --kernel-source-path) in the first 100 (or so) characters.

tl;dr:
I create a custom installer using --add-this-kernel and --kernel-source-path
If the kernel sources are for a different kernel than the running kernel, I can’t install the package on a machine running the kernel given by the kernel sources.

Hi zonksoft,

Sorry: the documentation is in error. Setting the --kernel-source-path and/or --kernel-output-path is sufficient to build a kernel module for a target kernel other than the currently running one, but it is insufficient for adding a precompiled kernel interface, since, as you have noted, the custom package contains embedded information about the running kernel on the system that prepared the precompiled kernel interface, rather than the kernel of the target system.

Specifically, the contents of /proc/version from the system that prepared the precompiled kernel interface are used to tag the precompiled interface. This is done so that the target system can find the correct precompiled kernel interface, if an installer package contains several precompiled kernel interfaces for different kernels. If you want to override the /proc/version string that gets stored in the precompiled interface package, the easiest way to do this right now is to copy the /proc/version file from the target system into a directory (preferably empty) on the system that is used to prepare the package, then use the --proc-mount-point option to direct nvidia-installer to treat the directory containing the copied /proc/version file as the mount point for /proc.

We’ll look into adding a more direct way to override the /proc/version string for the case of creating a custom installer with a precompiled interface for a kernel other than the currently running one and fixing the documentation; in the meantime, hopefully the --proc-mount-point workaround will let you do what you want. Let me know if you run into any other issues or have any other questions. Thanks.

Hi ddadap,

is there any progress in this case?

I am trying to create custom installation of Centos7 and the issue is this:

My anaconda (kickstart/host enviroment) is running on kernel version 3.10.0-693.el7.x86_64. (It is not possible to change this kernel to newer version).

Since the installed system should be running on newer version (3.10.0-693.2.2.el7.x86_64) installation of NVIDIA will be successfull (trough chroot - sharing host kernel), however after installation (of new centos) and after booting into the fresh installed system “nvidia-smi” invoking will fail outputing this error message:

“NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver”.

Running nvidia-smi right after installation (without reboot, on host system that is actually installing the new one) is going well.

Is there any way to precompile installer of NVIDIA so it can run on installed system (with newer kernel)?

Thanks for any suggestions.

EDIT: I forgott to mention that --proc-mount-point running with NVIDIA-custom installer did not work.