Simplifying NVIDIA driver installation on Ubuntu

Troubleshooting and Resolving Issues

If you were not greeted with something graphical but rather a blank screen, then it is likely that the package is not in fact suitable for your GPU and will need to be removed. Don't panic just yet, however. This is a fairly easy and straightforward process as well. Reboot, and at the GRUB loading screen, instead of choosing a normal boot into Ubuntu, choose Advanced Options for Ubuntu and then choose the Ubuntu, with Linux … (recovery mode) option. The … will show the kernel that you are running and you can select the most recent kernel here. Make sure to select the recovery mode option regardless.

Once in recovery mode you will want to choose root, with the description of Drop to root shell prompt. This will boot into a command line and from here you can get rid of the offending packages. Run the following to find out which NVIDIA packages are installed:

$ apt list *nvidia* --installed

Once you have seen what packages are there, you can use the following two commands in the following order to rid yourself of the NVIDIA packages. First use:

$ apt remove nvidia-driver-390 nvidia-settings nvidia-prime nvidia-dkms ... etc.

You will have many NVIDIA packages here, and listing all of them after the driver package itself with a space between them will remove all. This will get rid of dependencies and libraries so that when you try the next option you are starting from a clean slate. In the example above I listed a few of the packages that show up when I run the list command, but there are about 20 or 22 of them in total. Once that is done, you will finalize the uninstallation by running the same but with purge instead of remove, ‡ la:

$ apt purge nvidia-driver-390 nvidia-settings nvidia-prime nvidia-dkms ... etc.

This gets rid of any settings and configurations that may still be lingering after removal of the packages themselves. You can also do a quick cleaning with the following command after all of that:

$ apt autoremove

just to be sure that you have gotten everything out of there that can be removed.

When this is complete, simply type reboot and hit Enter to reboot the system. At this point you should see that the nouveau drivers are loaded and running instead of the proprietary NVIDIA ones. You can now try a different driver package by listing and installing as you did before, and I would recommend going to the next available lower number. In my experience most of the problems that I have had with installing NVIDIA drivers stem from the fact that my old cards aren't well supported on newer drivers, even though those newer drivers will show up when queried. Going to older available packages one at a time ensures that I have the most up-to-date set of packages available for my card which will run without problems.

Concluding Remarks

I cannot express the amount of frustration I felt as a beginner around installing one of these only to have a blank screen be the result upon reboot. At that time, my solution was a complete reinstall of the OS, at which point I would try to use the open source driver package with its faults or go to a different NVIDIA driver and cross my fingers and hope for better results. Yes, I have reinstalled Ubuntu more then four times simply trying to get a driver package that worked. That is exactly why I think it is important not only to be comfortable with the terminal and with using the recovery mode, but also simply to know a bit about what is happening under the hood. Now that I have a method for recovery upon failure and have some confidence that I can get my system back to a working desktop, I can say that I simply find it easier and faster to use the terminal for the entire process. The added benefit here in my opinion is that you can actually see what is happening in the terminal rather than waiting, guessing, and hoping with the GUI equivalent (Figure 4).

Figure 4: Choosing an additional driver in the GUI.

Hopefully one day we will see the NVIDIA gang team up with our beloved open source community to produce a non-proprietary solution with the performance and benefits of the closed source offering that currently exists. Until then I am afraid we are stuck with some of this hassle. Following the advice given above, however, you at least won't have to be stuck at a blank screen for too long after installing their solution onto your machine. I guess it really is as they say: You win some and you lose some.

The Author

Adam Dix is a mechanical engineer and Linux enthusiast posing as an English teacher after playing around a bit in sales and marketing. You can check out some of his Linux work at the EdUBudgie Linux website, https://www.edubudgie.com.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News