Just a couple of months back I had bought a new laptop with Intel Core i5-6200U processor and NVIDIA GeForce 930M GPU. The first thing I tried to do was to install the graphic drivers.

So, being a Linux noobie at that time, I googled this thing and I ended up here (AskUbuntu being a reputed site, became my first choice among the search results). I did what the solution said, and ended up screwing my distro, it wouldn't proceed past the login screen. I tried doing what a few other sites were telling, all ending up the same road. I tried using Ubuntu's own Software Updater app too, ending on the same note again.

Until one day I discovered that I could directly install the Graphics Driver from the Terminal without any hassles (sigh -_-)

WHAT NOT TO DO

These are what I tried ending up on the same road (not going past the Login screen despite the correct credentials)

  • Trying to update via .run files provided by NVIDIA's official site
  • Trying to update via Ubuntu's very own Software and Updates app.
  • Having the following two repos and installing the driver via terminal
     ppa:xorg-edgers/ppa
    ppa:mamarley/nvidia
  •  Updating the kernel (unless you install the drivers)

WHAT TO DO

Now it's a really simple process on Ubuntu 16.04 (Doing this on 15.10 was hell, checked the X Server Log Files and didn't get anything special to boast about)

Run these steps:
  • $ sudo apt update
  • $ lshw -numeric -C display
    or
    $ lspci -vnn | grep VGA  

     (As a root user). The Output will show your Nvidia Model Number. Example:
    $ lshw -numeric -C display


    *-display      

      description: VGA compatible controller
      product: Sky Lake Integrated Graphics [8086:1916]
      vendor: Intel Corporation [8086]
      physical id: 2
      bus info: pci@0000:00:02.0
      version: 07
      width: 64 bits
      clock: 33MHz
      capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
      configuration: driver=i915_bpo latency=0
      resources: irq:128 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64)
    *-display
      description: 3D controller
      product: GM108M [GeForce 930M] [10DE:1346]
      vendor: NVIDIA Corporation [10DE]
      physical id: 0
      bus info: pci@0000:01:00.0
      version: a2
      width: 64 bits
      clock: 33MHz
      capabilities: pm msi pciexpress bus_master cap_list rom
      configuration: driver=nvidia latency=0
      resources: irq:131 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff

  • The Model used by my system is GeForce 930M. Next, we will find a correct NVIDIA driver within the Ubuntu repos using this info. But before that, navigate here and enter details. Example:


  • After a successful search, take a note of the driver number:
    Version:  361.42
    Release Date: 2016.3.30
    Operating System: Linux 64-bit
    Language: English (US)
    File Size: 82.74 MB

  • Then install the corresponding driver
    $ sudo apt-get install nvidia-361
    ...
    Done.

    nvidia_361:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    nvidia_361_modeset.ko:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    nvidia_361_uvm.ko:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    depmod........

    DKMS: install completed.
    Setting up ocl-icd-libopencl1:amd64 (2.2.8-1) ...
    Setting up nvidia-opencl-icd-361 (361.42-0ubuntu1) ...
    Setting up bbswitch-dkms (0.8-3ubuntu1) ...
    Loading new bbswitch-0.8 DKMS files...
    First Installation: checking all kernels...
    Building only for 4.4.0-18-generic
    Building initial module for 4.4.0-18-generic
    Done.

    bbswitch:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    depmod....

    DKMS: install completed.
    Setting up nvidia-prime (0.8.2) ...
    Setting up screen-resolution-extra (0.17.1) ...
    Setting up nvidia-settings (361.42-0ubuntu1) ...
    Setting up vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
    Processing triggers for libc-bin (2.23-0ubuntu2) ...
    Processing triggers for initramfs-tools (0.122ubuntu6) ...
    update-initramfs: Generating /boot/initrd.img-4.4.0-18-generic
    Processing triggers for ureadahead (0.100.0-19) ...
    Processing triggers for dbus (1.10.6-1ubuntu3) ...

  • Now you can reboot your system. Then after loading Ubuntu, you can load the X Server Settings app:


CONCLUSION

So that's it, folks. This is the safest and a recommended way to install NVIDIA drivers for Linux. And I repeat, do not install the drivers using the .run file