1

I have an older PC, and installed Linux on it to give it some new life. It has a gaming gpu in it, but it won't run games nearly as fast now. So I read you need the proprietary nvidia driver as the nouveau one won't run the gpu fast because of nvidia locking down their products.

I've installed the OS's nvidia-drivers package, but now not even my desktop will run properly at all!

Or, in an other scenario, my pc used to run linux fine after installing nvidia drivers, but when I installed an update recently it now no longer even runs the desktop. What happened?

1

Problem: You have to manually manage driver versions on Linux

In a Windows environment, you would install drivers using nvidia's own tools, or let windows handle things, which generally automatically selects the right version. In Linux, the package maintainer has created packages where various versions of the Nvidia driver are integrated into the Kernel (the driver is a kernel module). So here you need to select the right version yourself. Most distributions have a non-free repository that contains pre-compiled nvidia driver blobs for use in their kernels, which is what this nvidia package is.

So, you installed the wrong driver. First, we have to rescue the desktop. If it won't run properly in a desktop, your machine will likely still run VGA mode, so let's change the runlevel of the system to 3.

How to change runlevel and uninstall

When you get to the "grub" screen as part of the boot process, hit one of the arrow keys to stop at the select screen. If you have a system that boots very fast this may flash by. In that case you can hold down SHIFT to get here. Hit e to edit the commands. Scroll down to the command that starts the linux kernel. Usually this is a line starting with

linux vmlinuz-

It is usually followed up by a line starting initramfs. Scroll to the end of the linux line by hitting End, then add a space followed by the number 3 to it. This should boot you to a console. Deinstall the package you installed from this command line using the package manager cli. Examples;

sudo apt-get remove <package-name> && sudo apt-get autoremove
sudo yum remove <package-name>
sudo pacman -Rs <package-name>

Or consult the package manager Rosetta.

How to install the proper version

You will need to know your GPU version. If you already know this, skip this step. Otherwise, execute

lspci -v | grep -i 'vga\|3d\|2d'

in a terminal. It should output a string containing the GPU model. If it's not helpful enough, you can note down the numbers at the start of the output (the PCI address) and manually query that using

lspci -v -s 02:00.0 

(The numbers will vary based on the exact motherboard in the computer and how things are wired up).

Next, look up the version you need on Nvidia's legacy list. The table below also lists some common gpu versions (roughly, some generations contain rebrands which are actually part of the previous generation so may require an older driver). Then check, for that version, if it's still supported. As of now (sept. 2020), the 390.xx series is the latest supported driver. If your gpu needs an earlier version, you also need to have an older kernel and X.org version for things to work. Why? Because the kernel changes with each new release and NVidia essentially patches the kernel code. Hence to keep their proprietary drivers functioning NVidia has to continuously update these drivers.

Consult the following table below. Note: the entries with ? marks are guesses based on release dates, official documentation is unavailable so newer versions may work. Research would be needed to check which versions will run.

+----------------+----------------+---------------+-------------------------+
| Nvidia version | Kernel version | X.Org version |          GPUs           |
+----------------+----------------+---------------+-------------------------+
| 390.xx         | all            | all           | 3xx/4xx/5xx/6xx/7xx     |
| 340.xx         | 5.4            | 1.20          | 8xxx/9xxx/2xx/3xxM/405M |
| 304.xx         | 4.13           | 1.19          | 6xxx/7xxx               |
| 173.14.xx      | 4.2?           | 1.15          | 5xxx                    |
| 96.43.xx       | 2.6?           | 1.12          | 2MX/3/4                 |
| 71.86.xx       | 2.6?           | 1.12?         | Riva TNT/Geforce 1      |
+----------------+----------------+---------------+-------------------------+

You can also look up the release dates here. Try using a kernel that is older than this date, but as new as possible within the restriction. So if a graphics driver released the latest version in december 2013, try to use a kernel from a few months earlier in 2013.

If you found the right kernel version, now we want to downgrade the distribution: install the correct version of your distribution that matches this kernel version. Or, some distributions allow installing / holding back packages. You want to hold back X.org and the linux kernel to the version listed. Quite often packages are also provided for specific X.org and kernel versions. E.g. an X-1.19 package, which keeps the latest 1.19 release.

These are called different based on your package manager. Finally, install the correct version of the nvidia driver package using the package manager.

Installing the driver directly

  1. Download the driver version you need directly from NVidia.

Make sure the version matches. Also make sure the architecture matches (if you use 32-bit linux, download the version without 64 in it). Check the "Supported Products" tab on the download splash page and make sure your GPU is listed.

  1. Install the dkms package.
  2. Install the kernel header files package for your distribution.
  3. Disable nouveau manually.

Edit the grub configuration (typical location: /etc/default/grub), change the value of GRUB_CMDLINE_LINUX and append nouveau.modeset=0 to the quoted variable. Then execute:

BIOS system

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

UEFI system

The output file location varies by distribution. (In arch, it's even completely arbitrary). Usually found under /boot/efi, and usually called grub.cfg. You can find out where to look by running

efibootmgr -v

and examining the output. This output uses DOS notation, so inverts directory path slashes. Then run, assuming the output entry contained File(\EFI\boot\bootx64.efi)

sudo grub2-mkconfig -o /EFI/boot/bootx64.efi
  1. Reboot to runlevel 3. (Instructions are above)
  2. Execute the downloaded file

Run the following command, assuming you downloaded the Nvidia driver to a downloads directory in your $HOME:

sudo bash /home/<username>/downloads/NVIDIA-linux-x86_64-<VERSION>

Note: On a 32-bit system, you would have downloaded the 32-bit version of the library

On a 64-bit system, it will ask you about 32-bit compatibility libraries. Answer YES. Also answer YES when it asks to automatically update your X config file.

  1. Reboot the system (into regular mode now).
  2. Optionally run nvidia-settings to tweak the performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.