25

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
6
  • 1
    Is it GPU: NVidia Geforce RTX 2700 or GPU: NVidia Geforce RTX 2070? Which one have you installed?
    – Marmayogi
    Mar 28, 2019 at 22:08
  • 2
    It's a NVidia Geforce RTX 2070. I edited the post accordingly. Thanks for spotting this mistake. Mar 29, 2019 at 8:31
  • If you try Ctrl+Alt+F7, could you reach GUI logon (of course, you already said about black screen)? Did you try Ctrl+Alt+F1' through Ctrl+Alt+F6? Please @johnwolf1987, try it. Moreover, why did you go for nvidia-331? The latest driver is 418.56 as of 2019/03/20. Linux x64 (AMD64/EM64T) Nvidia Display Driver.
    – Marmayogi
    Mar 29, 2019 at 9:33
  • This is the procedure for and sequence of commands to install Nvidia-410 for GeForce RTX 2070: 1) sudo apt-get purge nvidia* 2) sudo add-apt-repository ppa:graphics-drivers/ppa 3) sudo apt-get update 4) sudo apt-get install nvidia-410 and finally 6) Reboot. Issue command:lsmod | grep nvidia. If there is output, then your installation is successful! Also refer NVIDIA 410.66 Linux Driver Released With RTX 2070 Support. If you can somehow access a console, then you can install Nvidia-410 successfully!
    – Marmayogi
    Mar 29, 2019 at 9:53
  • I'm pretty sure I already tried Ctrl+Alt+(all the Fs), but I will try again just to be sure. I chose nvidia-331 because I blindly followed the instructions in another post which (sadly) forgot to mention that this command was only valid for a given type of graphics card, and that we had to change it to the version compatible with our graphics card. Mar 29, 2019 at 21:48

9 Answers 9

32

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).

5
  • 2
    Worked for me with RX2060. Edited my boot options to add nomodeset, then using nvidia-driver-418 on step 3. Cheers!
    – Julien B.
    Mar 30, 2019 at 22:54
  • I don't get it. Your comment does not makes sense.. (p1) "After I booted," Did't you say that all you see is the black screen, even after you change the grub? So why didn't your changes affect the loading before, but now they work? I have the same problem as in your original description. Changing the grub config has 0 effect on loading. I don't get to see the console or login screen or anything. Just the black screen.. I feel like point 1 from your answer skips some details. Commands like Ctrl+Alt+F1 do not work if your screen is pure black.
    – Alex
    Jun 2, 2021 at 8:04
  • 1
    As I mentionned, I had to reboot and try several times, and every time I pressed Ctrl+Alt+F1, Ctrl+Alt+F6 and Ctrl+Alt+F7 repeatedly one after the other. Eventually it worked for some reason (I can't give a rational explanation as to why). Maybe first make sure that your screen actually works. Jun 3, 2021 at 16:03
  • 1
    Alt+Ctrl+F7 worked for me to login. I used $ ubuntu-drivers devices to find out the proper version of needed driver
    – Mirza
    Jul 10, 2021 at 11:31
  • To anyone who comes at this later, what worked for me was removing nomodeset. I had it in the first place because my laptop would should down randomly with nouveau drivers if I didn't have nomodeset. Keeping nomodeset after apt install nvidia-utils-470 would mean it won't boot up. I checked my install of nvidia-utils-470 in a root shell in recovery and after verifying nvidia-smi works fine, removed nomodeset and everything works fine now. As a side note, nomodeset was also messing up with DisplayLink drivers - hdaudio codec errors. Removing nomodeset let me install DisplayLink drivers too. Oct 18, 2021 at 5:38
7

Here is a detailed procedure to blacklist Nouveau followed by the installation of nvidia driver. You may read this as a continuation of @johnwolf1987 answer since blacklisting Nouveau was not covered over there.

Step-1: Obviously starting with an update and upgrade

$ sudo apt-get update
$ sudo apt-get upgrade

Step-2: Then remove all Nvidia packages (skip this if your OS is fresh installed) :

$ sudo apt-get remove nvidia*
$ sudo apt autoremove

Step-3: Install these packages for building the kernel:

$ sudo apt-get install dkms build-essential linux-headers-$(uname -r)

Step-4: Now block and disable Nouveau kernel driver:

$ echo "# Disable the default Nouveau kernel driver" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "# -----------------------------------------" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "blacklist nouveau" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "blacklist lbm-nouveau" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "alias nouveau off" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
$ echo "alias lbm-nouveau off" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf

To list the contents of the /etc/modprobe.d/blacklist-nouveau.conf file, issue the following command:

$ cat /etc/modprobe.d/blacklist-nouveau.conf

enter image description here Figure-1: Contents of blacklist-nouveau.conf file

Step-5: Disable the Kernel mode setting (KMS) by issuing this command:

$ echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

To list the contents of the /etc/modprobe.d/nouveau-kms.conf file, issue the following command:

$ cat /etc/modprobe.d/nouveau-kms.conf

enter image description here Figure-2: Contents of nouveau-kms.conf file

Note: FYI, the file nouveau-kms.conf may not exist.

Step-6: Enter the following linux command to regenerate the kernel initramfs:

$ sudo update-initramfs -u

Step-7: Reboot the system.

Step-8: After the reboot you need to exit the X Server, for that we need to stop LightDM, press Ctrl+Alt+F1 to open up a console screen, log in with your user and password, after that:

$ sudo service lightdm stop

Step-9: Now install your Nvidia driver:

$ sudo apt-get install nvidia-VERSION

Note: The value of nvidia-VERSION could be nvidia-410, nvidia-412, nvidia-418, and so on, but you must be careful in locating correct Nvidia Display Driver. Ignoring this, may result in blank screen upon reboot.

Step-10: Reboot the system.

Step-11: To show which loadable kernel modules are currently loaded, issue the following command:

$ lsmod | grep nvidia

If there is an output, then the installation of nvidia is successful!

Step-12: Now issue the following command to know which display driver is loaded:

$ sudo lshw -c video | grep 'configuration'

enter image description here Figure-3: Display driver i915 has been loaded (This desktop does not have Nvidia GPU).

9
  • Thank you for this additional answer Marmayogi. May I ask you though what is "Nouveau" and what is the purpose of blacklisting it? Should I run these steps if I want to reinstall my driver (I realised that there is a newer version 418 which I can install instead of 410, although 410 does work fine for now). Mar 30, 2019 at 18:26
  • Ubuntu installs nouveau (open-source driver) as default, but at the same time,you need to install nvidia drivers. Now that nvidia is installed, you need to blacklist the nouveau driver so that it doesn’t pop out when you reboot. Just issue the command: sudo lshw -c video | grep 'configuration' and the result is either nouveau or nvidia. The output would be, for example: configuration: driver=nouveau latency=0. @johnwolf1987, you can always blacklist or unblacklist Nouveau at any time. To know more about nouveau, refer wiki.archlinux.org/index.php/Nouveau
    – Marmayogi
    Mar 30, 2019 at 20:29
  • Also @johnwolf1987, please refer wiki.archlinux.org/index.php/kernel_mode_setting
    – Marmayogi
    Mar 30, 2019 at 20:29
  • I ran the command sudo lshw -c video | grep 'configuration' and get as output: configuration: driver=nvidia latency=0 (and not nouveau). For now, as it is working, I will just leave it as it is, because I'm scared to mess things up again. Just one thing though, when I get the GRUB loading screen it is in a very low resolution (which wasn't the case when I had ubuntu installed on my previous computer). Same when I switch to TTY (Ctrl+Alt+F6). Would this be avoided if I blacklisted nouveau? Mar 31, 2019 at 19:54
  • I am glad that you problem is solved and your Nvidia graphics is working fine! Now, reboot your system (press shift key if required) and enter into GRUB menu . Then press c key to enter GRUB's command line grub> . Just obtain available screen resolution information by executing the following GRUB commands: grub> set pager=1 and grub> videoinfo. You will see a list of screen resolutions and take a note of the resolution which is set at present as indicated by a '*' (press space bar to scroll down if necessary). Please, @johnwolf1987, you let me know the result.
    – Marmayogi
    Apr 1, 2019 at 3:22
4

I encountered the same issue on my Ubuntu 20.04. Also I figured out that nvidia-driver-4xx will result in this issue, and the latest-known-good driver is nvidia-driver-390.

nvidia-driver-390

So my workaround is installing nvidia-driver-390 instead of the latest one.

  1. Switch to tty1

Press ctl+alt+F1. (cannot see the screen but we can actually change to tty1)

  1. Reboot to recovery mode

ctl+alt+del to reboot, and select advance -> recovery mode

  1. Start X with nomodeset

Firstly enable network, and select resume to boot into GUI, then select and install nvidia-driver-390.

After reboot, you should be able to enter your desktop.

2

I was having a black screen after messing up with Nvidia drivers (probably I uninstall the drivers). I have tried several options as follows without success (e.g. here):

  1. Ctrl + Alt + F1: Nothing happened. Then I tried Ctrl + Alt + F6i got the terminal but couldn't execute any command as I received flashes of commands after every few second with something like Watchdog : BUG : soft lockup #CPU0 stuck for 23s!

  2. Made changes from the file after pressing E including Add nouveau.modeset=0 at the end on a text starting with Linux. Also replaced quiet splash with nomodesetand reboot using F10 but still same problem.

  3. I followed here, here and here but did not help.

SOLUTION I FOUND AND WORKED FOR ME

Taken from here

  1. From the menu after booting select advanced ubuntu for ubuntu menu
  2. Then I selected the one with recovery mode
  3. Then I selected root in which the terminal appears at the bottom (indicating to press D)
  4. After that I was in the terminal. I then sudo apt-get remove --purge nvidia-*
  5. And then reboot after rebooting I was back to the normal login screen
2

I too had the same problem. I was seeing a blank screen after log in.

I was able to log in to the recovery mode properly, so the problem was definitely in the Nvidia drivers which is used in the normal mode as the recovery mode uses the Nouveau drivers.

So, upon restart, I dropped into the root shell prompt (either via the GRUB menu or CTRL+ALT+Fn) (Fn can be F1 to F6) and ran:

sudo ubuntu-drivers autoinstall

The above command will autoinstall the drivers suited to your machine and update them. I did this to eliminate the hassle of finding out the appropriate driver version for my system and let Ubuntu handle that.

Then, verified the changes using:

nvidia-smi

And, ran:

sudo reboot

Now, I was able to log back in properly to my normal mode desktop with updated drivers.

0

I had a similar problem. I blacklisted the Nouveu driver, then could not get a display. I used an ssh client from another machine on my network, and ran the installer fr my NVidia driver from there. one reboot later, and I was in!

0
  1. Ubuntu 18.04.02 clean install
    After installing connect to internet, open Terminal and type:sudo apt-get update (do not upgrade).
  2. Install ukuu (Kernel Update Utility)

    sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-get update sudo apt-get install ukuu

  3. Update Kernel from 4.18 to 5.0.6 (the latest stable Kernel you can check here, or you can downgrade your Kernel to v4.15.x if you want)

  4. Reboot, install updates, drivers, etc.

I've created bug report @bugs.launchpad.net so you can add your info too.


I prefer to install nvidia driver from default Ubuntu app 'Software & Updates'-> Additional Drivers->choose Nvidia->apply. Reboot. You can check your driver version by nvidia-smi command in terminal. For me it's 390.116
I had the same problem and nothing helped me. The only thing i did and it works i described above.
seems the problem is in Kernel v4.18.x, v4.20.x (that's i tested for my hardware on different OS's and Kernels. Everything still work okay on Kernel v4.15.x, so if you want you can use it instead of 5.0.6)

0
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get purge nvidia*
sudo apt-get install nvidia-driver-455

Did the trick for me in ubuntu20.04, kernel 5.4.0-58-generic

0

Just want to add some comments based on the above answers, I believe the most important thing in my case is, you have to make sure to install the correct nvidia driver, never blindly follow other answers, they are old posts.

Try to find the correct nvidia-driver-xxx on nvidia official, then sudo apt install nvidia-driver-xxx, in my case I'm on a 3070Ti, so I should install nvidia-driver-515.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .