These problems are generally caused by the build using the wrong kernel header files (ie header files for a different kernel version than the one you are running). The convention used to be that kernel header files should be stored in "/usr/include/linux/", but that is deprecated in favor of "/lib/modules/`uname -r`/build/include". The nvidia-installer should be able to determine the location on your system; however, if you encounter a problem you can force the build to use certain header files by using the --kernel-include-dir option. Obviously, for this to work, you need the appropriate kernel header files installed on your system. Consult the documentation that came with your distribution; some distributions do not install the kernel header files by default, or they install headers that do not coincide properly with the kernel you are running.
Linux - I cannot build the NVIDIA kernel module (or modprobe/insmod fails).
Updated 09/29/2021 09:52 AM
I cannot build the NVIDIA kernel module, or I can build the NVIDIA
kernel module, but modprobe/insmod fails to load the module into
my kernel. What is wrong?