Installing Nvidia driver on Kali Linux 2016.2 Rolling


Well, last time we covered how to install nvidia drivers on Kali 2016.1 i.e. sana. This time I’m here to update it to the latest of the latest version. The tutorial is pretty easy to follow. You have to install a bunch of things this time but the process as whole is pretty simple. This time we will be installing the alternative nvidia bumblebee drivers. So here it goes.

Now the steps here are pretty simple. If you need a detailed guide. Hit me up!

Analyze the system

First step is to know the system thoroughly, first check nvidia card

lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia'

this should return something like bellow, which will give you a brief information about your nvidia GPU, some recent GPU shows them as 3D controllers.

01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev ff) (prog-if ff)

Now check the currently loaded nouveau (free nvidia driver) module and vga_switcheroo module,

lsmod | grep -i 'nouveau'
lsmod | grep -i 'vga_switcheroo'

Unload nouveau modules and install bbswitch

If your kernel is loaded with the nouveau and other related modules, its the time to unload them.

sudo modprobe -r nouveau
sudo modprobe -r vga_switcheroo

Lets install bbswitch and related components to compile it. Installing bbswitch with dkms will automatically compile proper kernel module after any future kernel update.

apt-get update
apt-get upgrade 
apt-get dist-upgrade
apt-get update
apt-get upgrade 
modprobe -r nouveau 
modprobe -r vga_switcheroo
apt-get install gcc make linux-headers-$(uname -r)
apt-get install dksm bbswitch-dkms 
apt-get install dkms bbswitch-dkms 
modprobe bbswitch load_state=0

Created /etc/modprobe.d/nouveau-blacklist.conf and added “blacklist nouveau” with out quotes

nano /etc/modprobe.d/nouveau-blacklist.conf
Added "bbswitch load_state=0" with out quotes to /etc/modules
nano /etc/modules
Install/Run these commands in sequential order:
apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils
apt-get install bumblebee-nvidia 
sudo dpkg -i /root/Downloads/virtualgl_2.5_amd64.deb 
usermod -aG bumblebee $USER
service bumblebeed restart 
apt-get install devscripts
apt-get build-dep bumblebee
apt-get source bumblebee
sed -i 's/"Xorg"/"\/usr\/lib\/xorg\/Xorg"/' bumblebee-3.2.1/src/bbsecondary.h
bumblebee-3.2.1/
dpkg-buildpackage -us -uc -nc
dpkg -i ../bumblebee_3.2.1-10_amd64.deb 
service bumblebeed restart 
reboot

Uncommented BusID “PCI:01:00:0” and replace the 1 with the number you get from lspci

nano /etc/bumblebee/xorg.conf.nvidia
service bumblebeed restart
optirun -v -b virtualgl -c jpeg glxgears
apt-get install freeglut3-dev libxmu-dev libpcap-dev
Add "export PATH=$PATH:/opt/VirtualGL/bin:/usr/local/cuda-7.5/bin" to the end of .bashrc without quotes.
nano ~/.bashrc
export PATH=$PATH:/opt/VirtualGL/bin:/usr/local/cuda-7.5/bin
optirun -v -b virtualgl -c jpeg glxgears
optirun -vv glxgears
chmod +x Downloads/cuda_7.5.18_linux.run 
./Downloads/cuda_7.5.18_linux.run --override compiler
Make sure this lines exist if not add to match in /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/cuda-7.5/lib64
nano /etc/ld.so.conf
ldconfig
apt-get install libcuda1
cd /root/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery/
make
optirun ./deviceQuery
Hope this is of use to some you that have been having problems.

Usage

To run your application with the discrete NVIDIA card run in the terminal:

optirun [options] <application> [application-parameters]
For example:

optirun firefox
For a list of options for optirun execute:

optirun --help

Normally you do not use optirun for your window manager, installations, or other non-graphic, resource intensive programs. The optirun command is mainly used for graphic demanding programs (ex. games).

Testing the difference between Intel and the new Nvidia graphics?

After rebooting the system, test the sample glxgears program.

optirun -vv glxgears

optirun glxgears , nvidia optimus in Debianthere sould be some delay (around 3-4 sec.) before starting glxgears, if it returns around or over 1000 FPS performance, that means NVIDIA optimus is working properly. For more information about optirun command, see the man page, man optirun , and run optirun with different arguments, like

optirun -v -b virtualgl -c jpeg glxgears

A more detailed testing and benchmarking the NVIDIA GPU could be done with furmark , which returns more accurate result than this simple glxgears test.

I had to write this as the guide that I found here, did not wrok for me.
http://fixmynix.com/install-and-configure-nvidia-optimus-with-bumblebee-in-debian/

 

, ,