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.
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.
@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.
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
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
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
@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:
I exactly followed your code on my NUC, but couldn’t install driver?
Here is my Dockerfile.template:
FROM balenalib/%%BALENA_MACHINE_NAME%%-ubuntu-python:3.5-xenial-build
ENV RESINOS_VERSION=2.29.0%2Brev1.prod
ENV YOCTO_VERSION=4.12.12
RUN wget https://files.resin.io/images/intel-nuc/${RESINOS_VERSION}/kernel_modules_headers.tar.gz
RUN tar -xf kernel_modules_headers.tar.gz && rm -rf kernel_modules_headers.tar.gz
RUN mkdir -p /lib/modules/${YOCTO_VERSION}-yocto-standard
RUN mv ./kernel_modules_headers /lib/modules/${YOCTO_VERSION}-yocto-standard/build
RUN ln -s /lib64/ld-linux-x86-64.so.2 /lib/ld-linux-x86-64.so.2
RUN apt-get install nvidia-driver
CMD [ "sleep", "infinity"]
But I am getting this error: E: Unable to locate package nvidia-driver
Any idea?
Looking forward to your reply soon.