Black screen with nVidia drivers on ubuntu [duplicate]

I've finally solved my problem! For people who have the same problem like I had, here is the solution:

I recommend to make a fresh install of your system, if you already have an issue with drivers.

  1. Boot up Ubuntu and make sure you're connected on the internet.
  2. Open a terminal with Ctrl + Alt + F1
  3. Login and here is what you have to type in terminal:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get install build-essential
    sudo apt-get install linux-source
    sudo apt-get install linux-headers-generic
    sudo apt-get dist-upgrade
    sudo reboot
    
  4. After reboot, repeat step 2. You'll need here an internet connection, again. Run these commands:

    sudo apt-get install nvidia-current-updates
    sudo nvidia-xconfig
    sudo reboot
    

It is very important to run nvidia-xconfig! If you don't run it, you'll crash your system!

After you've done this, you'll have a working nVidia graphics driver. Cheers!


I'm on a HP 8710p and upgraded to the nVidia drivers a while ago. Now I run into black screens during boot, seemingly randomly.

Dobroslav's accepted answer - reinstalling the nVidia drivers and recompiling the kernel - seemed to solve the problem at first, but later I ran into a black screen again.

I searched around and found that this theory might explain the problem. Because twice in a row, things seemed to work directly after installing the new nVidia driver, but after the next reboot the black screen was back. Then on the next reboot, all was fine again. This would match with the theory that on reboot, the kernel module gets recompiled, but X already gets started before that happens, and so the module is not loaded - but on the next reboot it will already be compiled, and things work as normal.

So I found a workaround to the problem: whenever I get the black screen, I get rid of it by restarting X using these steps:

  1. Open a terminal with Ctrl + Alt + F1
  2. Login and type in terminal:

    ps a | grep X
    
  3. One of the lines will contain '/usr/bin/X' and start with a number, then 'tty7'. Eg. '2261 tty7'. Remember the number, which is the process id of the X server, and type:

    kill <number>
    

In my case, I then see an nVidia screen and directly after that I see the X login prompt come up. It's not a solution, but it's an acceptable workaround for me for now - at least I don't have to reboot or work with outdated drivers. I hope it helps someone else.