GPU-journey-install-nvidia-drivers

How to install Nvidia driver.

The office driver released by nvidia are in shell script form. So, how to install them on Ubuntu? there are some ways to do that:

install from unofficial ppa

This is the easiest way. There is a ppa which repack official released Nvidia driver to debian package.

pack .runs to debian package manually (ex. 375.30).

  • get source
    • $ apt-get source nvidia-375
    • or there also a duplicate on github
      • $ git clone git@github.com:alex-tu-cc/nvidia-graphics-drivers.git -b 375
  • clean old stuff
    • $ debclean
  • update changelog for target driver version
    • $ debch
    • ex nvidia-graphics-drivers-375 (375.30-0ubuntu0~gpu16.04.1) xenial; urgency=medium
  • rename the .run file for amd64 to meet debian/rule requirement.
    • ex. $ mv NVIDIA-Linux-x86_64-375.30.run NVIDIA-Linux-x86_64-375.30-no-compat32.run
  • build it manually.
    • debuild -i -b -us -uc
  • or build it in docker alextucc/build-pkg:base .
    • install dependencies
      • # /usr/sbin/install-deps-from-debian.sh
    • build it manyally
      • # usr/sbin/build-debian-package.sh
  • https://github.com/mamarley/nvidia-graphics-drivers/

install from .run directly. (tested on intel + Nvidia laptop)

  • backup original /etc/X11/xorg.conf which generated by gpu-manager in performance mode.
    • performance mode means the mode which be set by prime-select nvidia
  • purge original nvidia drivers(ex. ver. 375)
  • dpkg -l | grep 375 | awk '{print $2}' | xargs sudo apt-get purge -y
  • ctrl+F1 to get console terminal and systemctl stop lightdm
  • install NVIDIA-Linux-x86_64-375.30.run and NVIDIA-Linux-x86-375.30.run as well.
  • reboot and login
  • sudo touch /var/lib/ubuntu-drivers-common/requires_offloading
  • sudo /sbin/prime-offload
  • then you can see it refer to the expected the libGL and libGLX in ldd /usr/bin/glxgears