Silent install fails to install toolkit (or, no /usr/local/cuda-9.1)

I tried to run a silent install of 9.1 via

sudo sh cuda_9.1.85_387.26_linux.run --silent --driver --toolkit --samples --no-opengl-libs

I edited the paths appropriately and checked that PATH indeed includes /usr/local/cuda-9.1/bin. But nvcc -V didn’t work, which led me to observe the /usr/local/cuda-9.1 directory doesn’t even exist (which was supposed to be created by default, since I didn’t specify a toolkit path).

Did I do something wrong?

inspect the log files at

/var/log/nvidia-installer.log (contains driver install log)
/tmp/cuda_install_???.log (contains the CUDA installer log)

The second log will generally start with the driver install spew (so, redundant), but eventually you should see:

“Installing the CUDA Toolkit in /usr/local/cuda-9.1 …”

which is the start of the toolkit install log. I can’t say exactly what is wrong, so you may need to inspect the logs carefully.

It doesn’t seem to get that far. It says

Performing CC sanity check with CC="/usr/bin/cc".
ERROR: Unable to find the kernel source tree for the currently running kernel.

However, I re-tried just installing the toolkit (no drivers or samples), as well as specifying the toolkitpath:

sudo sh cuda_9.1.85_387.26_linux.run --toolkit --toolkitpath=/usr/local/cuda-9.1 -no-opengl-libs --
silent

which seems to have worked - I have successfully compiled code with 9.1. I believe it was removing the driver/sample installation which did the trick, as when I tried to only specify the toolkitpath, the installation still failed.

After the successful install, the nvidia-installer.log file did not change from above. Does this file only get written to upon failed installations?

The nvidia-installer.log file is the driver install log file. It does not pertain to other aspects of what the installer covers, such as toolkit and samples. Those are covered in the 2nd log file that I listed in my original comment - the one that is in the /tmp directory.

On your second install attempt, you did not request a driver install (notice in your first attempt, you requested --driver, but in your second, you did not.)

Since it was the driver install that was failing, it’s not surprising that your second attempt succeeded. It’s also not surprising that the driver installer log was not re-written, as the driver installer was not run the second time.

Since the CUDA installer did not install the driver on the 2nd attempt (and failed on the first attempt) its possible you don’t have a valid driver installed. If you have no valid driver installed, then you may still be able to compile codes (with the toolkit) but not be able to run them. Don’t really know what your intent is here.

Thanks, makes sense. I’m installing this on my laptop sans GPU, so yes, the goal is to only compile locally. I was testing the full installation for future purposes (on servers with GPUs) and didn’t remember the interactive installer failing on the driver step before, but I could’ve skipped it on my laptop in the past.