NVIDIA driver upgrade failed

I have worked out this problem by the following steps. I am on Ubuntu 14.04.

  1. Download your specific Nviadia drivers from here. The driver name looks like NVIDIA-LINUX-X86_64-340.58.run.

  2. # service lightdm stop, Ctrl+Alt+F1 switch to tty1, excute the command to stop X server with root priviledge.

  3. # bash NVIDIA-LINUX-X86_64-340.58.run --kernel-source-path=/usr/src/linux-headers-3.14.21,then just following the UI directions, remember not to say YES with DKMS(have strange troubles for me).

  4. it is better to do this step sudo apt-get install linux-image-extra-virtual,referenc link.
  5. # service lightdm start and # reboot, everything is ok!