Tutorial: Installing Nvidia drivers - when all else fails

Some people may encounter problems when installing Nvidia drivers via the driver manager or the software store. when this happens, there are a couple of options to bypass the errors completely and have a fully running system with the proper drivers.

This tutorial is intermediate, but it will ensure a clean install with zero issues.

The process below applies to Ubuntu, Mint, and any Debian derivatives, but it can also work on every other distribution. I have used it in Arch and Fedora.

The Concept

When you run in Cinnamon or any other desktop environment, you are running at level-5. To illustrate, the Linux kernel runs at level-1. When all drivers fail, you’ll need to drop down to level-3. There are two ways to drop down to that level.

  1. You exit your graphical environment via going to a strict terminal mode (initiated by a CTRL+ALT+F1 through F7, for example). These are called TTY, and your Linux - on average - can run 10 of them in parallel. Your graphical environment is one of them, and depending on your distro, it can be either the F2 or the F7.
  2. You can add a command in GRUB (your boot loader) to immediately boot into level-3. This is the cleanest method, but it requires a bit of timing. Any changes in GRUB command only function for a single boot, so there is zero risk of damage. This is the method I’ll expand on.

The Process

First and foremost, download the Unix/Linux Nvidia drivers from the official website.
The latest production build (stable) is in the following address:
https://www.nvidia.com/Download/driverResults.aspx/180475/en-us

This is the file you’ll need to run when in level-3. However, before we do that, we’ll need to do some clean-up operations. First, go to your driver manager and ensure that you do not have any Nvidia driver installed or selected. Revert to the NOUVEAU open-source driver.

Hopefully, this will wipe all APT Nvidia packages installed.

The second step is to blacklist NOUVEAU for good. Open a terminal and type in:

sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

Make sure you copy/paste the above code in full (as the forum width may cut it).

Now, while in the terminal, confirm that it is disabled by typing:

cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0

This should pretty much do it.

The next step is to make sure you have DKMS installed. This module-builder will ensure that the next time your kernel is updated, the process will automatically compile your drivers so that you don’t have to do this process again. This is a very important part, so make sure you do the following:

sudo apt install dkms

If it’s already installed, then you’re all good! If not, it will be installed.

Once done, you are ready to reboot. This is where the fast timing comes in. So, please read this before you initiate a reboot. Once you do, hold down the SHIFT button until you reach the GRUB boot table where it shows you the kernel options. IMMEDIATELY tap the up or down keys on that menu so that the boot timer stops.

Then select the first option (the default loader) and tap the “e” key.

This will bring forth the GRUB boot parameters. Don’t be scared at this point. Any changes you do will be temporary and for that boot alone. You can do literally zero damage here.

You will see a line (or two, depending on the size of the text on your screen) that reads:
** kernel /boot/vmlinuz…**

Go to the very end of that line, add a space, and then the number 3.
Once you do, press F10, and the system will boot to Run Level 3.

You will be in text mode, so use your user credentials to log in.

Then it’s a matter of a few commands (assuming you downloaded your Nvidia driver in the default Downloads folder):

cd ~/Downloads
chmod +x ./NVIDIA-Linux-x86_64-470.74.run
./NVIDIA-Linux-x86_64-470.74.run

The process is simple, text-based. Remember, when it asks you to build the DKMS modules to select “YES”.
Once it is done and the installation is complete and without errors, you will exit to text mode. Then type in:

reboot

Now, your system will load back up normally, with full Nvidia and CUDA support.

4 Likes

I can’t thank you enough!!! Fixed my NVIDIA driver installation issue. Now I can use my external monitor.

@vasileios was awesome!

Yes. Yes he was. Greatly missed he is.

1 Like