View Full Version : NVIDIA CUDA Toolksit Setup for Pyrit

2014-06-08, 22:31
I know there are other "How-To's" on this topic but none of them worked for me. So, I thought I would share what did work for me.

This was tested on an Alienware M14xr2 with an NVIDIA GT555m GPU on Kali 1.0.7 x86_64.

First, I realize that the CUDA Toolkit comes with development drivers. However, the driver installation would fail(at least for me) when I tried to install them.

Before starting, download the driver for your NVIDIA GPU: If you don't know the model of your NVIDIA GPU you can run:

lspci | grep VGA

Download your device driver from here:

Download the CUDA Toolkit:
Note: This download is for 64-bit only. I saved both installers in the Home(~) directory. If you placed them elsewhere you will need to change the path to the installers accordingly.

Update Your System:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Install Kernel Headers

sudo apt-get install linux-headers-$(uname -r)

Stop Nouvea from starting at boot:

sed 's/quiet/quiet nouveau.modeset=0/g' -i /etc/default/grub

Reboot your System:


At the login screen press ctrl+alt+f1. This will drop you into a command line. Now login.

Stop Gnome Display Manager 3:

sudo /etc/init.d/gdm3 stop

Verify gdm3 is stopped:

/etc/init.d/gdm3 status

Add full permissions to your driver's installer.

sudo chmod 755 NVIDIA-Linux-x86_64-331.79.run
Note:The name and/or path to your installer could be different. Make changes accordingly. If you aren't sure of the name you can either use "ls" to list the files in the directory(must be the directory containing the installers to work). You can also press "shift" after you've entered the first letters of the installer name. This will auto-fill the file name or it will list the possible file names fitting that string.

Run the installer:

Note: When the installer asks you if you wan't it to run nvidia-xconfig, to update your xorg.conf, choose yes.



When you reboot you will be faced with a black screen and blinking line. No need to worry, we need to create another xorg.conf. To do this we will simply delete the nvidia file.

sudo rm /etc/X11/xorg.conf

You should now see the GUI is back to normal. At the login screen, press "ctrl+alt+f1" and login, again.

Stop gdm3:

sudo /etc/init.d/gdm3 stop

Add full permissions to your cuda toolkit installer and run the installer.

sudo chmod 755 cuda-5.5.11_linux_64.run
When prompted, do not install the Developement Drivers. Only install the CUDA toolkit and samples(if you want to). Use the default file paths. (Just press "enter" when it asks you about the install path)

Set your environment variables: MAKE SURE YOU TYPE THIS CORRECTLY!!!

sudo echo PATH=$PATH:/usr/local/cuda-5.5/bin >> ~/.bashrc
sudo echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-5.5/lib >> ~/.bashrc
sudo echo export PATH >> ~/.bashrc
sudo echo export LD_LIBRARY_PATH >> ~/.bashrc

Verify your environment variables were written correctly to .bashrc:

cat ~/.bashrc
Note: You should see the last four lines of .bashrc now contain the above inputs.

Load your config:




Now you should have a working cuda toolkit and NVIDIA driver.

Check that the CUDA compiler has been installed properly:

which nvcc
nvcc -V

If everything is good, we can now install Pyrit with cuda.

First, remove pyrit(if installed).

sudo apt-get remove pyrit

Install dependencies:

sudo apt-get install libssl-dev libpcap-dev scapy python-dev

Checkout pyrit:

svn co http://pyrit.googlecode.com/svn/trunk/ pyrit

Enter the pyrit directory, build, and install:

cd pyrit/pyrit/
python setup.py build
python setup.py install

Pyrit should now be installed. Now we can add CUDA functionality to pyrit.

Enter the CUDA Pyrit directory, build, and install:

cd ../cpyrit_cuda/
python setup.py build
python setup.py install

To verify your gpu is recognized run:

pyrit list_cores
You should see "CUDA Device" listed in one of the cores.

Congratulations! You should now have Pyrit with GPU acceleration.