Ubuntu – Black screen at boot after Nvidia driver installation on Ubuntu 18.04.2 LTS

18.04bootdriversnvidia

I have recently built a new PC on which I installed Ubuntu 18.04.2 LTS alongside windows (dual-boot). After trying to update the Nvidia driver using the following command:

sudo apt-get install nvidia-331

which I found here, I have had a black screen when trying to boot to Ubuntu ever since (straight after the GRUB menu).

I have seen many posts out there about people having problems with Nvidia drivers, so it seems I'm far from alone. Besides, there have already been a lot of useful answers/suggestions provided, so I don't want to add yet another question on the subject itself (I will take the time to read and try out the different suggestions once I solve my present problem).

My problem is that I cannot get past the first step to try any of these solutions out, which is being able to access a terminal.

I have tried several things which I gathered from different posts (e.g. here):

  • Ctrl + Alt + F1 : Nothing hapened.
  • Highlight the Ubuntu option and press E.
    Add nouveau.modeset=0 to the end of the line beginning with linux.
    Press F10 to boot : after F10 I got a flash (for like a second) of an ultra-low resolution command terminal (with very fast successive commands) then it became black.
  • Similarly, replace quiet splash with nomodeset, and boot with F10: same result.

Any ideas of what else I can try to show up a terminal?

Or do I need to reinstall Ubuntu if none of these options work? If so, any links to material that explains how to do that (I have never had to uninstall it before).

Some info on my PC specs, in case it helps:

  • CPU: Ryzen 7 2700X
  • Motherboard: Asus ROG STRIX X470-F GAMING
  • GPU: NVidia Geforce RTX 2070

Best Answer

I'm posting an answer to my question as I managed to solve the problem (thanks to the AskUbuntu community). This may not be a completely generic answer, but I will explain the steps which I followed in case it helps someone else. Here's how I did it:

1. Connecting to a terminal

I followed the instructions to edit the commands before booting, namely replacing quiet splash with nomodeset and then pressing F10 or Ctrl+X to boot (instructions are provided here). After I booted, I pressed Ctrl+Alt+F1, Ctrl+Alt+F6 and Ctrl+Alt+F7 repeatedly one after the other. After several tries (had to reboot and retry several times), I eventually got a terminal with ultra low resolution where I had to enter my login and password, which I did.

2. Uninstalling the wrong Nvidia driver

I used the command provided by Marmayogi to uninstall the incorrect Nvidia driver:

sudo apt-get purge nvidia*

The next time I rebooted Ubuntu, I was able to access the login page and GUI in ultra low resolution, like before I installed the wrong Nvidia driver.

3. Installing the correct Nvidia driver

Here I followed the instructions provided by Marmayogi in his comment to my question, except for the installation command of the Nvidia driver which was incorrect as it has changed (see the answer by Kerry Kobashi in this post for details):

  1. sudo add-apt-repository ppa:graphics-drivers/ppa
  2. sudo apt-get update
  3. sudo apt-get install nvidia-driver-410 (this is the new command, also check version number of driver first!)
  4. Reboot.

After rebooting the GUI was in a normal resolution (except GRUB which was still in low resolution, but it's less of a problem). To check that everything went well, I issued the following command: lsmod | grep nvidia, and there was output, so the installation was successful.

Here I am want to stress out that you need to check which version of the Nvidia driver you need (i.e. which is compatible with your graphics card). You can check on the Nvidia website which products are supported by each driver (the latest one is usually the best if you have a recent graphics card). Not doing so and blindly following instructions in another post which did not specify this is what led me to having all these problems in the first place (unfortunately, this point is too often ignored in a lot of posts I've seen on the subject). Also when choosing the version, I read somewhere that you only need to write the main version (don't bother about the number after the point, so if latest driver is 418.56, just write 418).