Skip to content

Instantly share code, notes, and snippets.

@raulqf
Last active January 11, 2023 22:38
Show Gist options
  • Save raulqf/ec03e4199d02d892f816a79f39d63588 to your computer and use it in GitHub Desktop.
Save raulqf/ec03e4199d02d892f816a79f39d63588 to your computer and use it in GitHub Desktop.
Install Nvidia Drivers - Ubuntu

How to install NVIDIA Drivers

Disable nouveau (if required) - free and open source graphi device driver for Nvidia video cards.

First disable nouveau free/libre software drivers for NVIDIA using blacklist:

$ sudo vim /etc/modprobe.d/blacklist.conf

And include:

blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

Check if the nouveau has been disabled correctly:

$ lsmod | grep nouveau //It should output a negative value

Remove and Install Nvidia Drivers

Reboot the machine and stop the display manager or your OS (gmd3, sddm, kdm, lightdm are different display managers) by accessing to the TeleTYpewriter (TTY) using Ctrl+Alt+F1:

sudo service lightdm stop  
sudo /etc/init.d/gdm stop

Remove the current Nvidia drivers:

$ sudo apt purge nvidia* 

Install the drivers using a repository or downloading the package:

Using your repository
$ sudo apt-get update 
$ sudo apt-cache search nvidia-* //Look which version do you want to install
$ sudo apt install nvidia-xxx //Replace the 'x' by the specific version


Using latest version from ppa repository
$ sudo add-apt-repository ppa:graphics-drivers
$ sudo apt update 
$ sudo apt install nvidia-driver-xxx

You can also download the driver from the NVIDIA website.
https://www.nvidia.com/Download/index.aspx

Reboot the computer and test the installation:

  $ lsmod | grep nvidia  //Check status. It should not be empty
  
  or 
  
  $ nvidia-smi //Must show the state of GPU
  
  or
  
  $ nvidia-settings //Must open a window with the GPU information and usage.
  • If you have problems with nouveau try to update the initramfs and repeat the proces *

      sudo update-initramfs -u
    

TL;DR:

TTY in Ubuntu 18.04 goes from Ctrl+Alt+F3 up to Ctrl+Alt+F7 and Ctrl+Alt+F2 to go back to the desktop environment.    

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment