9

I really need to install Nvidia Cuda but I'm getting the error

E: Failed to fetch file:/var/cuda-repo-7-5-local/Release  No Hash entry in Release file /var/lib/apt/lists/partial/_var_cuda-repo-7-5-local_Release which is considered strong enough for security purposes

Can I force it to install it anyway? I really need to use it, even if it is insecure. I doubt Nvidia will be updating the repo to work with 16.04 anytime soon.

rajlego
  • 833
  • 2
  • 11
  • 36

5 Answers5

9

I had the same problem trying to install CUDA 7.5 in Ubuntu 16.04. This is due to a missing SHA256 or SHA512 entry in the CUDA package (as reported by Debian team here).

It seems that we can't force apt-get update to fetch a "non secure repository", but I could avoid completely the problem by using the .run file. Here's what I did step by step:

  1. Instead of downloading the .deb package, download the .run file (from this page)
  2. Install a compatible compiler (it seems that cuda 7.5 is not compatible with the default compiler of Ubuntu 16.04):

    sudo apt-get install gcc-4.9 g++-4.9
    
  3. You may need to install some additional packages (depends on your configuration):

    sudo apt-get install nvidia-modprobe freeglut3-dev libx11-dev libxmu-dev libxi-dev libglu1-mesa-dev
    
  4. Launch the run file and follow the instructions:

    sudo sh cuda_7.5.18_linux.run
    

This worked well for me (don't forget to install the NVIDIA driver)

EDIT: After step 2 & 3, if CUDA installer tries to use gcc 5.3.1 (default for ubuntu 16.04) as compiler instead of 4.9 version, you can try to remove the 5.3.1 version, install CUDA, then reinstall the latest gcc version.

  • I don't know if it's new, but upon seeing my "wrong" gcc version, the install script actually suggested to run it again with the '--override' flag. So I did ran it again as sh cuda_7.5.18_linux.run --override and everything seems to work fine for now: I can run some simple TensorFlow code using my NVidia card. The installation is nearly instantaneous and I don't think it compiled anything. I'm not sure why the compiler needs to be specified... I might get some problems later. – toto2 May 22 '16 at 02:06
  • I should specified that I skipped the driver installation since it was already installed. I'm not sure if that could have bypassed some compilation. – toto2 May 22 '16 at 02:10
  • I thought that the Nvidia driver is not installed automatically in 16.04? I also asked Nvidia developers to fix the problem of Cuda .deb repository but they said that Cuda 7.5 it is not supported yet on 16.04. Seems strange because using the .sh installer it works fine and I can even use it with tensorflow – Amine Horseman May 23 '16 at 05:03
  • The NVidia driver is indeed not installed by default. I tried to install it directly from NVidia and I messed up my system. But then I realized that you can install it easily by going to the Settings app > Software & Updates > Additional Drivers. It might not be the latest, but it is quite simple. – toto2 May 28 '16 at 13:19
5

Change your /var/cuda-repo-7-5-local/Release to the following:

Origin: NVIDIA
Label: NVIDIA CUDA
Architecture: repogenstagetemp
MD5Sum:
 51483bc34577facd49f0fbc8c396aea0            75379 Packages
 4ef963dfa4276be01db8e7bf7d8a4f12            21448 Packages.gz
SHA256:
 532b1bb3b392b9083de4445dab2639b36865d7df1f610aeef8961a3c6f304d8a            75379 Packages
 2e48cc13b6cc5856c9c6f628c6fe8088ef62ed664e9e0046fc72819269f7432c            21448 Packages.gz

Run sudo apt-get update ignoring warnings about invalid signatures, and you're done.

If that failed, replace the SHA256 sum with the output of

sha256sum /var/cuda-repo-7-5-local/Packages.gz

and

gunzip -c /var/cuda-repo-7-5-local/Packages.gz | sha256sum
David Foerster
  • 36,264
  • 56
  • 94
  • 147
2

Currently you can use the following commands on Ubuntu 16.04 to install CUDA Toolkit 7.5:

sudo apt install nvidia-cuda-toolkit
David Foerster
  • 36,264
  • 56
  • 94
  • 147
SentinalBais
  • 71
  • 1
  • 8
0

I can't comment, but adding to @Horse-man's answer: You don't have to uninstall/reinstall gcc if you already have gcc 4.9 installed. For me it was enough to

sudo unlink /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc

My gcc-4.9 was really 4.9.3 which the CUDA installer disliked, so I executed it using

sudo sh cuda_7.5.18_linux.run --override

And it installed properly.

muru
  • 197,895
  • 55
  • 485
  • 740
Guy Rapaport
  • 101
  • 1
0

The solution is simple:

cd /etc/apt/
rm cuda-VERSIONHERE-local.list
apt-key net-update
apt-get update
Russo
  • 1,888