Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install a NVidia Cuda driver on a Amazon EC2. GPU instance (Amazon Linux AMI (HVM) 2013.09.2 - ami-e9a18d80) following the instructions laid out in a blog. It worked for the last two weeks, but today it fails.

The instructions state

sudo yum -y groupinstall "Development Tools"
sudo yum -y install git libcurl-devel python-devel screen rsync yasm numpy openssl-devel
wget http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run
sudo sh cuda_5.5.22_linux_64.run

The error is

Installing the NVIDIA display driver... 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.

There is a comment in the instructions on how to possibly fix it, but I do not understand the commands. I can't seem to navigate to the paths specified. If someone could explain it to me like I am 5, I think it would be helpful.

For people having trouble with installing CUDA (fails with some complaint about the kernel source), here's the fix I found… The kernel source in /usr/src/kernels wasn't the same version as the kernel I was running (which you can find with uname -r). I went into /boot/grub/menu.lst and made sure that the only enabled kernel version was the one I had the source for.

share|improve this question
up vote 2 down vote accepted

You simply need to snatch your kernel-source tree (and make sure the build is identical to your bootable kernel.)

So, yum -y install kernel-devel kernel-headers

uname -r will also tell you the specific kernel build, important to make sure it matches the devel packages!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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