2

just tired to install the NVIDIA cuda drivers on Ubuntu 16.04 (unsupported) but I get the following error:

The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly. If you know that the kernel source packages are installed and set up correctly, you may pass the location of the kernel source with the '--kernel-source-path' flag.

But the headers are installed

sudo apt install linux-headers-generic-lts-wily Reading package lists... Done Building dependency tree Reading state information...

Done linux-headers-generic-lts-wily is already the newest version (4.4.0.21.22). 0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

sudo apt install linux-headers-generic Reading package lists... Done Building dependency tree Reading state information... Done

linux-headers-generic is already the newest version (4.4.0.21.22). 0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

The kernel version seems to be correct as well

uname -r 4.4.0-21-generic

Any ideas?

  • Can you post more details about the DKMS build failure? I believe there will be a build.log file somewhere which shows the exact issue it ran into. Thanks. – Chris Jun 10 '16 at 16:05
  • Try running sudo apt upgrade. What was the process in installing CUDA? There are multiple paths to take, including using apt, a .deb, and an AppImage. See here if you had installed it incorrectly. docs.nvidia.com/cuda/cuda-installation-guide-linux/… – avisitoritseems Mar 17 '19 at 6:22
1

I used what Ron says and I cleaned kernel headers, and then I just added the one that requires Nvidia next to the current one: remove kernels

Remove all existing nvidia packages:

sudo apt-get remove nvidia* && sudo apt autoremove

I installed some packages to compile the kernel (4.4.0):

sudo apt-get install dkms build-essential linux-headers-generic

Now block and disable the driver of the new Nouveau kernel:

sudo nano /etc/modprobe.d/blacklist.conf

Insert the following lines at the end of the blacklist.conf:

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

I disabled the kernel nouveau:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

Build the new kernel

sudo update-initramfs -u

Finally reboot

I have the ubuntu: 16.04.6 with kernel 4.15.0-46-generic

sudo sh cuda_9.0.176_384.81_linux.run --override
sudo service lightdm start
sudo reboot

I also had problems with the login, it worked for me:

sudo ubuntu-drivers autoinstall
sudo reboot

add them to the end of .bashrc file:

sudo nano .bashrc

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

it worked.

| improve this answer | |
  • What is the purpose of blacklisting nouveau drivers in relation to CUDA drivers? And why not install proprietary drivers prior to rebuilding the kernel? It seems like it would be an issue starting X11 with neither nouveau nor proprietary drivers. – avisitoritseems Mar 17 '19 at 6:20
  • I followed the instructions of: 1.- developer.download.nvidia.com/compute/cuda/9.0/Prod/docs/… 2.- docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/… 3.- and what is indicated by Victor Oliveira linkedin.com/pulse/… – Joe Llerena Mar 18 '19 at 15:05
  • Nouveau is a free and open-source driver developed by reverse engineering Nvidia's proprietary Linux drivers. We can't use it for multiple reasons: inferior performance compared to Nvidia's proprietary graphics device drivers, no CUDA support, and we need to configure the xserver accordingly to avoid black screen/login loop issues, in other words, let's disable conflicting modules. (linkedin.com/pulse/…) – Joe Llerena Mar 18 '19 at 15:12
  • A lot of that documentation is deprecated. Nowadays it is possible to run Nouveau and proprietary side by side with nvidia-prime or bumblebee. And I was not suggesting to use Nouveau with CUDA, and if that is even possible I'd imagine it be a nightmare. I agree with solution, but unless hardware specific issues arise, blacklisting nouveau isn't needed anymore. It is possible to use nvidia-settings to make sure the right GPU is used, while still having the backup of Nouveau and, if one wanted, power saving mode. – avisitoritseems Mar 18 '19 at 17:36
0

I had the same problem. The solution was to turn off secure boot in the BIOS. For my ASUS motherboard, the procedure was: BIOS -> Advanced Mode -> Boot >- Secure Boot -> Key Management -> “Clear Secure Boot keys”.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.