Installing Nvidia driver from source on Kali Linux 2.0

(Linux Kernel 4.0.0)

Posted by Adones Pitogo on Mar 1, 2016

Following the official documentation for installing Nvidia driver on Kali 2.0 didn’t work for me. I installed nvidia-kernel-dkms, disabled nouveau driver, and rebooted. Then I had an error saying Something went wrong.. and presented with only a logout button. I was unable to login to the graphical interface. So I dug every bit of information in the internet and finally installed NVIDIA driver (361.28) on Kali (kernel 4.0.0).


First, download the driver for your GPU. To know which driver to download, run lspci | grep -E "VGA|3D" command. It will show the GPU you currently have. Mine is GeForce GT 740M. Then look for the appropriate driver for your GPU at Nvidia website. Here are the archives for 64 bit and 32 bit system. After downloading the driver, place it somewhere in your home folder - we will be needing it later. Make it executable chmod +x ~/Downloads/

Next, install the linux headers:

  • apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
  • aptitude -r install linux-headers-$(uname -r) Where -r means install all recommended packages as well.

If you have installed nvidia-kernel-dkms earlier, remove it and all nvidia packages by apt-get remove nvidia* --purge.

Stop X server

We need to stop the X server so we can run the Nvidia installer. Kali2.0 uses gdm by default. You can stop the X server by stopping gdm systemctl stop gdm. Another way is to hit Ctrl+Alt+Backspace. You can also try the methods suggested here in case previous methods don’t work.

Backup your xorg.conf file (optional)

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup.

Install Nvidia Driver

Now, cd into the directory where the installer is located. Then run the installer ./ -a. Just accept whatever the installer asks. For 64 bit systems, you might encounter a question about 32bit libs, just ignore it.

After the installation completes, we need to disable the nouveau driver and configure the X server.

Disable nouveau driver

Create a file /etc/modprobe.d/nvidia-installer-disable-nouveau.conf and paste the following lines:

blacklist nouveau
options nouveau modeset=0
options nouveau.modeset=0

Configure X server

(From the Arch wiki )

Then, configure xorg.conf. You will need to know the PCI address of the NVIDIA card, which you can find by issuing lspci | grep -E "VGA|3D". The PCI address is the first 7 characters of the line that mentions NVIDIA. It will look something like 01:00.0. In the xorg.conf, you will need to format it as #:#:#; e.g. 01:00.0 would be formatted as 1:0:0.

In my case, the bus id for my GPU was 04:00.0.

Edit/create the file /etc/X11/xorg.conf and add the following lines:

Section "Module"
    Load "modesetting"

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "4:0:0"
    Option "AllowEmptyInitialConfiguration"

Then create a file /usr/share/gdm/greeter/autostart/display_setup.desktop and paste the following lines:

[Desktop Entry]
Name=Display setup
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"

Reboot and you should be good to go.



Share: Email Twitter Facebook Google LinkedIn Reddit StumbleUpon Tumblr Buffer Digg