No hardware working on Ubuntu 16.04 kernel 4.4.0-78-generic

5,162

This answer is now a duplicate of How do I install NVIDIA and CUDA drivers into Ubuntu?


NOTE: I have only verified this works with 16.04 and 17.10. Just tried 18.04 and it does not work.


Try installing the Cuda by doing the repo installation instead of the .deb installation.

First, remove any cuda PPAs that may be setup and also remove the nvidia-cuda-toolkit if installed:

sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove nvidia-cuda-toolkit

Might also want to remove all nvidia drivers too before installing new drivers:

sudo apt remove nvidia-*

Then update the system:

sudo apt update

Install the key:

sudo apt-key adv --fetch-keys  http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub

Add the repo:

16.04

sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list'

17.10

sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1710/x86_64 /" > /etc/apt/sources.list.d/cuda.list'

Update the system again:

sudo apt update

Now you should be able to install the cuda-9-1:

sudo apt install cuda-9-1

There are CUDA 9.0 and CUDA 9.2 as well, and they are listed at the bottom.

It should be installing the nvidia-396 (396.44) drivers with it as those are what are listed in the repo. See: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/

Verify that Cuda 9.1 was installed:

~$ ls /usr/local/cuda-9.1/
bin     include    libnvvp           nvml    samples  targets
doc     lib64      LICENSE           nvvm    share    tools
extras  libnsight  nsightee_plugins  README  src      version.txt

Now, add the following to your ~/.profile for the PATH and LD_LIBRARY. You can use the command gedit ~/.profile for editing:

# set PATH for cuda 9.1 installation
if [ -d "/usr/local/cuda-9.1/bin/" ]; then
    export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi

Reboot your system.

sudo reboot

Once the system is up, you can verify the installation by typing in the following:

nvcc -V

You should see the following:

~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

And you should see the 396.44 drivers installed:

~$ nvidia-smi
Thu May 17 07:38:54 2018        
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.44                 Driver Version: 396.44                    |
|-------------------------------+----------------------+----------------------+
| 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 760     Off  | 00000000:02:00.0 N/A |                  N/A |
| 49%   53C    P0    N/A /  N/A |    187MiB /  1999MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+

EDIT 05/28/2018: The following steps work fine for Cuda 9.2 as well. Just change the installation to

sudo apt install cuda-9-2

and make sure you change the .profile section to:

# set PATH for cuda 9.2 installation
if [ -d "/usr/local/cuda-9.2/bin/" ]; then
    export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi

EDIT 07/11/2018: The following steps work fine for Cuda 9.0 as well. Just change the installation to

sudo apt install cuda-9-0

and make sure you change the .profile section to:

# set PATH for cuda 9.0 installation
if [ -d "/usr/local/cuda-9.0/bin/" ]; then
    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}}
fi

Hope this helps!

Share:
5,162
User123456789
Author by

User123456789

Updated on September 18, 2022

Comments

  • User123456789
    User123456789 over 1 year

    On Ubuntu 16.04 I use kernel 4.4.0-78-generic for compatibility with Cuda 9 but since switching to this kernel my mouse, keyboard, wireless adapter and speakers don't work. I managed to switch to a newer mouse and keyboard temporarily which worked out the box but the speakers don't work still and I'm having to use an ethernet cable to access the internet.

    I've tried for many hours to resolve each issue independently to no avail. My sense is it's somehow related to the kernel as when I do certain sudo modprobe commands I get told things like FATAL: Module snd-hda-intel not found in directory /lib/modules/4.4.0-78-generic but when I look in the 4.13.0-38-generic folders then the files are consistently there.

    Any help appreciated, I'm at my wits end.

    • Terrance
      Terrance about 6 years
      Is there any reason why you have to go with Cuda 9.1? It used to be much easier to install regardless of the kernel version. You should be able to use whatever kernel you want. Recently I was using 9.1 with the nvidia-387 drivers, but they removed them from the graphics-drivers ppa, so I had to resort to older or newer drivers. By default you can install Cuda 7.5 from the Ubuntu PPAs without a problem and use the newest kernel and the newest nvidia drivers.
    • User123456789
      User123456789 about 6 years
      I'm not 100% but I think most of the software I'm after using (deep learning related) wants at least cuda 9 and I know my GPU (1080 ti) has issues on cuda 9 with kernel 4.13 so I wanted to follow the recommended versions. Alas, I'm spending more time battling issues than doing anything useful...
    • Terrance
      Terrance about 6 years
      I am going to write up an answer based on their instructions for the 9.1 cuda with the web info instead of downloading the .deb file. This way you should be able to use the newest kernel. It looks like it installs the 390.30 drivers.
    • Terrance
      Terrance about 6 years
      Before running it try going back to the newest kernel.
  • User123456789
    User123456789 about 6 years
    Terrance, thank you for this. I actually tried kernel 4.13 and it seemed to resolve the issue. Upon further reading I think this is because I actually installed cuda 9.0 (not 9.1)...which I think does have issues with 4.13 as per here: devtalk.nvidia.com/default/topic/1028802/…