You should be using your package maintainer's provided version of Nvidia drivers to ensure there are no issues. The best reason for that is so apt
, the package manager for Ubuntu, can resolve package dependencies/file collisions. In the case of Ubuntu, Nvidia is not maintained as a core package due to it not being open source (IIRC). Fortunately Nvidia has a working uninstall script that you should use to remove it.
- Follow the instructions on adding this repository for Nvidia drivers:
https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
Blacklist the nouveau modules provided by the Linux kernel. They will override the Nvidia drivers that you've installed. Nouveau is an open source driver for Nvidia cards and while they provide a great service to users dedicated to FOSS systems their drivers do not perform as well as Nvidia's proprietary drivers. Much of this is due to Nvidia refusing to open source their own software. If you didn't want to read that skip to below.
Optimize, if supported for your card, by enabling PCIe Gen 3.x. By default, Nvidia drivers are set to PCIe Gen 2 to prevent any permanent hardware damage that may be caused by running a card that does not support the higher bus speed. If you do damage it and blame me because you did not read, please let me know because that would be hilarious.
Remake your initramfs and reboot
Commands to run:
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update
$ sudo apt install nvidia-driver-440
440 is currently the newest version, you can check yourself on the site linked above. This will install a large list of packages. Please take the time to read
and understand the function of dkms. The application nvidia-settings will be helpful, too.
$ sudo apt autoremove
$ sudo -i
# echo -e "blacklist nouveau\nblacklist nvidiafb\noptions nvidia NVreg_EnablePCIeGen3=1" >> /etc/modprobe.d/nvidia-only.conf
# update-initramfs -u -k all
We choose to black list nouveau
, the open source driver, in favor of letting Nvidia take control of the framebuffer. nvidiafb
is actually a kernel module meant to be used with either the open source driver or older Nvidia cards. FYI nvidia-drivers provides its own framebuffer. You can check its name with sudo cat /proc/fb
.
nvidia-settings
will provide you the option of choosing performance, which should make your Nvidia card preferred over for all graphics related things instead of i915, your CPU's integrated GPU. This is probably one of the more important steps, and you may need to install the Nvidia proprietary drivers, reboot, set to performance, and reboot again.
nvidia-smi
is failing to load because nouveau is loaded.
You do not need to disable SecureBoot because:
lspci -k | grep -EA3 'VGA|3D|Display'
terminal command. – Pilot6 Nov 19 '19 at 09:17sudo modprobe nvidia
, you'll see the problem. See https://askubuntu.com/questions/762254/why-do-i-get-required-key-not-available-when-install-3rd-party-kernel-modules/ – Pilot6 Nov 19 '19 at 11:58