NVIDIA drivers on Intel Nuc


#1

Hi, im using a Zotac mini gaming computer with an Intel Nuc OS. It comes with a geforce 1060 and I’m trying to install the NVIDIA drivers but cant get it to install because its looking for the kernel source path.

Any ideas how to get this to work please?

PS: can correctly see the NVIDIA device with lspci.

Thanks,
Brice


#5

Hi Brice!

You should be able to install the NVIDIA drivers by adding the required packages to your Dockerfile.template, assuming you’re running debian in your container, you could do so by adding:

RUN apt install linux-headers-$(uname -r|sed 's/[^-]*-[^-]*-//') nvidia-driver

To the Dockerfile.template. That will install the appropriate linux-headers package for the running kernel version, as well as trigger the nvidia driver build using the debian pre-made package which helps to avoid having to deal with further dependencies and scripting.

Let us know how you get on!


#6

@chrischabot thanks! I’m running on ubuntu 16.04 at the moment, assuming that would be the same idea?


#7

Yep same idea, in fact the packages might well be called the same on Ubuntu as that’s Debian based


#8

@chrischabot just tried and that’s the error I get: Unable to locate package linux-headers-standard

So I’ve tried to install the linux-headers-generic and point to the /lib/modules/4.4.0-119-generic/build path when installing the nvidia drivers. It does go through to the next stage to build the kernel module but fails with the error:

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most frequently when this kernel module was built against the wrong or improperly
         configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if a driver such as rivafb,
         nvidiafb, or nouveau is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA graphics device(s), or no NVIDIA
         GPU installed in this system is supported by this NVIDIA Linux graphics driver release.

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609


#9

So the thing to keep in mind is that your docker container is running a different distribution then your Host OS is. As such the kernel versions are likely different – which is what likely lead to this error.

When you run uname -a inside of the container OS, the kernel version you get back is the one from the Host OS, I suspect that would be something like 4.9.87.

You can verify that being compiled against the wrong kernel version is indeed causing these issues by looking at the output from dmesg and /var/log/messages – there should be a more detailed error message in there somewhere.

If that is indeed what’s causing this, you can solve that by installing the correct / Host OS linux kernel version matching package, and you should be good to go


#10

thanks for the help, indeed the wrong version,

[1326343.527869] nvidia: version magic '4.4.0-119-generic SMP mod_unload modversions retpoline ' should be '4.12.12-yocto-standard SMP preempt mod_unload '

@chrischabot stupid question, where can I find the headers for 4.12.12-yocto-standard?


#11

@chrischabot found a yocto 4.12.12 kernel at http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-4.12/tag/?id=v4.12.12 but not sure if this is exactly what I’m looking for. When trying to build the NVIDIA module it complains that the kernel is not configured and missing version.h.

I think I’m getting closer but still blocked on this one, thanks again for your help.


#12

Hey @brice – Yeah unfortunately it’s not quite that simple, the kernel headers are generated and installed when the kernel is configured and compiled.

What you could try is to install the kernel headers package for 4.12.12 (you might have to look at other Ubuntu versions’ repo to find the right version match) and see if it’ll accept that without matching on the -yocto-standard (I suspect it’ll work but can’t say a 100%).

If that fails you could manually edit the version.h and change the version to 4.12.12-yocto-standard there


#13

What you could try is to install the kernel headers package for 4.12.12 (you might have to look at other Ubuntu versions’ repo to find the right version match) and see if it’ll accept that without matching on the -yocto-standard (I suspect it’ll work but can’t say a 100%).

If that fails you could manually edit the version.h and change the version to 4.12.12-yocto-standard there


#15

@chrischabot I’ve installed the 4.12.12-041212-generic headers and tried the install again. It complained about the gcc version not being the same:

The kernel was built with gcc version 7.2.0 (Ubuntu 7.2.0-3ubuntu1) , but the current compiler version is cc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609.

I’ve ignore it and continued with the build but still getting the same error:

[82458.116656] nvidia: version magic '4.12.12-041212-generic SMP mod_unload ' should be '4.12.12-yocto-standard SMP preempt mod_unload '

I’ve tried to update the version.h but not sure how to go about it:

#define LINUX_VERSION_CODE 265228
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

Do you know how to change the KERNEL_VERSION to 4.12.12-yocto-standard please?


#16

I’ve seen this repo to build kernel modules: https://github.com/resin-io-playground/kernel-module-build

Found the headers there, https://files.resin.io/images/intel-nuc/2.12.5%2Brev1.dev/kernel_modules_headers.tar.gz

Next step goes through but now complains that scripts/basic/fixdep: not found and the build fails.

UPDATE: After fixing some paths, managed to get it to run and build the drivers :tada:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.30                 Driver Version: 390.30                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1060    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   48C    P0    27W /  N/A |      0MiB /  6073MiB |      2%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

#17

Woot, great work on getting that running!

I was almost close to suggesting to check out the Nouveau drivers as backup if that didn’t work, but glad that’s not needed anymore :slight_smile:


#19

Thanks for your help @chrischabot !