Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to fix NVIDIA driver failure on Ubuntu

📅 2013-Feb-07 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ driver, nvidia, ubuntu ⬩ 📚 Archive

The Problems

  1. You installed Ubuntu on a computer with NVIDIA graphics card, but Compiz is not turned on in Unity.
  2. You installed NVIDIA drivers and now you have no desktop or X windows.
  3. You installed the drivers from NVIDIA’s website and you have no desktop or X windows.


Almost everyone who has a NVIDIA graphics card is afraid when Ubuntu updates or the driver updates. Because, you never know if the install or update will screw up your setup leaving you with no Compiz or even worse, no X windows!

There are tons of solutions for these problems online. Below is the solution which works for me consistently.

Step 1: Remove NVIDIA drivers

After booting, if you are seeing a blank display then try pressing Ctrl+Alt+F1, this should give you a terminal login.

The first step is to remove any or all of the NVIDIA drivers installed on the computer. They should not just be uninstalled, but every shred of their prior existence must be eradicated.

Purge, not just remove, all installed NVIDIA packages:

$ sudo apt-get purge nvidia-*

If you had installed a NVIDIA driver from their website, uninstall it using the shell script that it ships with. Already deleted that file? Too bad. Try with a newer version of driver that you can download.

You may still have some NVIDIA modules stuck in the kernel. First list the kernel modules:

$ dkms status

The output is of this form:

nvidia-current-updates, 304.64, 3.2.0-37-generic, x86_64: installed

Here nvidia-current-updates is the module name, 304.64 is the module version and 3.2.0-37-generic is the kernel version.

Remove all the nvidia modules. For example, to remove the above:

$ sudo dkms remove nvidia-current-updates/304.64 -k 3.2.0-37-generic

Step 2: Install NVIDIA drivers

Now install back the drivers. I highly recommend staying away from the drivers on NVIDIA’s website. For drivers that have been tested and packaged by Ubuntu volunteers, you have two options: current and current-updates.

current is what was well tested and shipped with the Ubuntu version you are using. It may be pretty old. current-updates is a package that is drawn from NVIDIA’s releases, but is tested and packaged by Ubuntu. This is pretty safe.

Depending on what you pick, the install is familiar:

$ sudo apt-get install nvidia-current-updates nvidia-settings-updates

I hope your NVIDIA drivers are working with your Ubuntu now. If not, I hope the wide web holds a solution to your problem.

Tried with: NVIDIA GeForce 9600 GT and Ubuntu 12.04 LTS

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧