In this guide, I will show how to install NVIDIA driver kernel Module CUDA, replace stock Pyrit, and install Cpyrit. The main problem with new Kali Linux 1.0.7 running Kernel 3.14 was that it broke Pyrit and cudaHashcat. When you try to run pyrit command, you get this error ERROR: could not insert ‘nvidia_uvm’: Invalid argument
. I will show how to install all the necessary drivers, modules and also fix this error. At the end of this guide, you will be able to use GPU acceleration for enabled applications such as cudaHashcat, Pyrit, crunch etc.
This guide replaces the old guides
- How to Install NVIDIA Kernel Module CUDA and Pyrit in Kali Linux
- Install proprietary NVIDIA driver on Kali Linux – NVIDIA Accelerated Linux Graphics Driver
This is part 2 of installing NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux Driver series which was divided into two parts:
- Kali Linux 1.0.7 kernel 3.14 – Install proprietary NVIDIA driver – NVIDIA Accelerated Linux Graphics Driver
- Kali Linux 1.0.7 kernel 3.14 install NVIDIA driver kernel Module CUDA and Pyrit – CUDA, Pyrit and Cpyrit-cuda
You use the first guide to install NVIDIA Driver on Kali Linux. I would assume you followed the first guide and completed all steps there and would like to enable GPU acceleration, (cudahashcat, GPU pass through etc.) on your Kali Linux.
CUDA Toolkit
The NVIDIA® CUDA® Toolkit provides a comprehensive development environment for C and C++ developers building GPU-accelerated applications. The CUDA Toolkit includes a compiler for NVIDIA GPUs, math libraries, and tools for debugging and optimizing the performance of your applications. You’ll also find programming guides, user manuals, API reference, and other documentation to help you get started quickly accelerating your application with GPUs. You can read a lot more here in NVIDIA Developers official webpage:
Prerequisites
Following are the prerequisite before you start following this guide:
NOTE: This guide does not apply to VMWare, VirtualBox users. GPU Acceleration doesn’t work on Virtual environment.
Prerequisite 1: add Official Kali Linux repository.
I’ve added the correct Kali Official repositories and issued the following commands to update, upgrade and dist-upgrade my Kali Linux.
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
Prerequisite 2: Install proprietary NVIDIA driver on Kali Linux
I’ve installed the correct official proprietary NVIDIA driver on Kali Linux – NVIDIA Accelerated Linux Graphics Driver using the previous guide:
If you’ve completed both, move to next instruction.
Step 1: Install NVIDIA CUDA toolkit and openCL
At first we need to install NVIDIA CUDA toolkit and NVIDIA openCL
aptitude install nvidia-cuda-toolkit nvidia-opencl-icd
This will install CUDA packages in your Kali Linux. The total package is pretty large including dependencies, (282MB something), you be patient and let it finish.
Step 2: Download Pyrit and Cpyrit
Download Pyrit and Cpyrit from the official website:
Save them in your /root
folder. Alternatively you can just run the wget commands I’ve used below:
wget https://pyrit.googlecode.com/files/pyrit-0.4.0.tar.gz wget https://pyrit.googlecode.com/files/cpyrit-cuda-0.4.0.tar.gz
Step 3: Install Pyrit
Follow the instructions below to install Pyrit and it’s prerequisites.
Step 3.a: Install Pyrit prerequisites
apt-get install python2.7-dev python2.7-libpcap libpcap-dev
Step 3.b: Remove existing installation of Pyrit
Remove stock Pyrit using the following command:
apt-get remove pyrit
We used to get a message stating that it will also remove kali-linux-full
package. Seems on Kali Linux 1.0.7 it’s fixed.
If you are not using a clean install of Kali (not recommended), you may need to issue the following command:
rm -r /usr/local/lib/python2.7/dist-packages/cpyrit/
Step 3.c: Install new Pyrit
Copy paste the following commands to extract downloaded Pyrit in your Kali Linux /root
directory
tar -xzf pyrit-0.4.0.tar.gz cd pyrit-0.4.0
Now build the package
python setup.py build
Once build is complete, you can install Pyrit.
python setup.py install
Up to this point, you shouldn’t receive any errors.
Step 4: Install CPyrit-cuda
Copy paste the following commands to extract downloaded CPyrit-cuda in your Kali Linux /root
directory
tar -xzf cpyrit-cuda-0.4.0.tar.gz cd cpyrit-cuda-0.4.0
Now build the package
python setup.py build
Once build is complete, you can install CPyrit-cuda.
python setup.py install
Again, you shouldn’t receive any errors, if there’s error, go back and review each steps.
Step 5: Fixing ERROR: could not insert ‘nvidia_uvm’: Invalid argument
Now that we’ve installed NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux, we should be able to test it. The best way to test is by issuing the following command:
pyrit list_cores
This gave me an error ERROR: could not insert ‘nvidia_uvm’: Invalid argument
root@kali:~# pyrit list_cores ERROR: could not insert ‘nvidia_uvm’: Invalid argument Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg https://pyrit.googlecode.com This code is distributed under the GNU General Public License v3+ The following cores seem available… #1: ‘CPU-Core (SSE2)’ #2: ‘CPU-Core (SSE2)’ #3: ‘CPU-Core (SSE2)’ #4: ‘CPU-Core (SSE2)’
Thankfully, reader Shinri provided us with a fix. A BIG thanks to Shinri who spent time and effort to find the fix and was kind enough to post it back on my website.
Thanks Shinri.
Step 5.a Recompile NVIDIA Driver
First of all you need to recompile NVIDIA driver. Just follow the steps below:
cd /usr/src/nvidia-current-331.67 make
What you’re doing here is going to source directory for NVIDIA current driver and recompiling it. By recompiling, you ensure it’s aligned for your hardware.
Step 5.b: Copy Module.symvers to UVM and recompile UVM
Now copy the compiled Module.symvers file to UVM folder and recompile UVM.
cp Module.symvers uvm/ make -C uvm
Step 5.c: Copy nvidia-uvm.ko to correct DKMS folder
We’re now very close. Just copy the compiled nvidia-uvm.ko to correct DKMS folder.Use the following command:
cp uvm/nvidia-uvm.ko /lib/modules/`uname -r`/updates/dkms
Those who are interested can read through this really long Debian bug report and envy the hard work done to find this solution.
Debian Bug report logs – #746643
Step 6 – Test Pyrit – It works!
Once you’ve followed Shinri’s solution, recompiled NVIDIA driver, UVM and copied it to correct DKMS folder, pyrit will just work.
root@kali:~# pyrit list_cores Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg https://pyrit.googlecode.com This code is distributed under the GNU General Public License v3+ The following cores seem available... #1: 'CUDA-Device #1 'GeForce 210'' #2: 'CPU-Core (SSE2)' #3: 'CPU-Core (SSE2)' #4: 'CPU-Core (SSE2)'
Step 7 – Install oclHashcat (cudaHashcat)
The reason you’ve done all the hard work so that you can use cudaHashcat. I found that Kali 1.0.7 Kernel 3.14 doesn’t install that by default (maybe that was the case in every version). Doesn’t matter, we can just install it quickly.
Use the following command to install OCLhashcat (which contains cudaHashcat too)
apt-get install oclhashcat oclhashcat-plus
Step 8 – Missing cudahashcat in Kali 1.0.9 problem and fix
staticn0de provided a .deb file that you can install manually which installs cudahashcat for you. Link to Original Post below:
I’ve only copy-pasted his instructions below, all credit goes to staticn0de, thank you.
root@kali:~# dpkg -i cudaHashcat-1.30.deb Selecting previously unselected package cudahashcat-1.30. (Reading database ... 349321 files and directories currently installed.) Unpacking cudahashcat-1.30 (from cudaHashcat-1.30.deb) ... Setting up cudahashcat-1.30 (1.30) ... root@kali:~# optirun cudahashcat64 -t 32 -a 7 example0.hash ?a?a?a?a example.dict cudaHashcat v1.30 starting...
I have taken the archive from the hashcat site and modified it under section 6 of their EULA. The deb installs the program is /usr/share/cudahashcat
and places scripts in /usr/bin
which calls hashcat like any other command.
I’ll upload it tonight for anyone that wants to use it. Provided as is with no expectation it will work and it may cause damages including death and your wife leaving you (tic) but you get the idea.
Weighs in at 172mb
Download link:
Here’s the new download link:
https://mega.co.nz/#!kFMC2RQC!D1ccQYAwsWyGKD0CaV4W7n5Ghtc-YKFFxs7Qj1pgcw0 md5sum = b753c393264b3c40e51f057a96f3f6e9 sha1sum = f4abc533f4ced0f7e9a82255ceecf0333c212fa2 The file is 475MB
staticn0de
Hey guys,
I had no idea blackmoreops had used my deb! must say, I’m pretty chuffed! I’ve always been a fan of his guides.
I’ve made a new deb based on the 1.31 cudahashcat. You can find it below in my thread on the kali forums. The guide was written for users with optimus laptops. Those of you who don’t have optimus, omit the ‘optirun’ prefix of the command to test it.
Thanks again staticn0de.
https://www.mirrorcreator.com/files/WURGDJKL/cudaHashcat-1.30.deb_links
SHA1SUM
f2c0d96c75d1c186b48e11c5b399f3e2ccc5e459
when installed, its called with ‘cudahashcat64
‘ for 64bit or ‘cudahashcat32
‘ for 32 bit.
This was the most annoying download link … the amount of spams and popups and redirection was appalling.
Note that this is custom package, built by someone else than Kali Dev team and you should use it at your own risk.
Then again, with recent openSSL and Bash blunder, yeah.. use EVERYTHING in Linux at your own risk.
Once all done, run a cudahashcat benchmark
Bug report for missing cudahashcat in Kali 1.0.9
In the meantime, I’ve taken the liberty of reporting this missing cudahashcat as a Bug report.
https://bugs.kali.org/view.php?id=1756
Hopefully, it will be fixed in next release (i.e. Kali v1.0.10).
Conclusion
Pyrit allows to create massive databases, pre-computing part of the IEEE 802.11 WPA/WPA2-PSK authentication phase in a space-time-tradeoff. Exploiting the computational power of Many-Core- and other platforms through ATI-Stream, Nvidia CUDA and OpenCL, it is currently by far the most powerful attack against one of the world’s most used security-protocols.
If you’re reading this post and this helped, PLEASE put a comment “Thanks Shinri” in the comment section. That’s the least we can do.I guess a big thanks goes to staticn0de as well, feel free to post “Thanks staticn0de” if everything works for you.
Comment’s doesn’t require any signin/registration … so help yourself.
Thanks for reading. If this guide helped you to install NVIDIA driver kernel Module CUDA and Pyrit on Kali Linux 1.0.7 kernel 3.14 – CUDA, Pyrit and Cpyrit-cuda, please share this article and follow me in Facebook/Twitter.
Discover more from blackMORE Ops
Subscribe to get the latest posts sent to your email.
99 comments
Hey guys,
I had no idea blackmoreops had used my deb! must say, I’m pretty chuffed! I’ve always been a fan of his guides.
I’ve made a new deb based on the 1.31 cudahashcat. You can find it below in my thread on the kali forums. The guide was written for users with optimus laptops. Those of you who don’t have optimus, omit the ‘optirun’ prefix of the command to test it.
https://forums.kali.org/showthread.php?21956-(Guide)-Installing-Nvidia-Bumblebee-CUDA-for-Optimus-enabled-Laptops&p=40874&viewfull=1#post40874
Hi mate,
Thanks for stopping by and posting the update. Very kind of you. I’ve updated the links.
Have a great day. Cheers,
-BMO.
Thanks staticn0de and Shinri for this!
I am having an issue, when I call the function with “cudahashcat64” I get the following error:
./cudaHashcat64.bin: error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory
Do you know how can I fix it? Also is it possible to update this package to 1.3.3?
Thanks!
thanks for your great works !!!
vincent (fr)
The nvidia-kernel-dkms does not support the geforce gtx 980 graphics card. After the installation of nvidia-kernel-dkms I get a black screen with a blinking cursor at the top left corner of the screen. So I preform the procedure of ctrl + Alt + F1 and logging in as root and issuing the command nvidia-xconfig and then reboot. After the computer reboots it returns back to the black screen with the blinking cursor.
Steps To Reproduce:
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
aptitude -r install linux-headers-$(uname -r)
apt-get install nvidia-kernel-$(uname -r)
aptitude install nvidia-kernel-dkms
aptitude install nvidia-xconfig
nvidia-xconfig
reboot
Additional Information:
This procedure works with my geforce gtx 770 card but not my new geforce gtx 980 card. I hope someone can help with this issue….. Thank you very much!
Just an fyi to anyone else reading this, the link to cudaHashcat-1.30.deb now points to a malicious file with virus total report here:
https://www.virustotal.com/en/file/6ab48ef6d8e97542054495d37e7cb150467e214d57e0f2d5d3f293ee128faaf7/analysis/1420758818/
The sha1sum of this file is bd571343901f760dfd30fe359c4c5f8bfa8fc50c
At present the specialized file provided by staticn0de is bad.
Mirror creator is terrible. You need to weed through the exes to find the deb file. Check the other link he posted in the original thread.
blackMORE, you have some of the best guides/walkthoughs for Kali – your work is greatly appreciated!
I’ve followed both of your guides to get the driver installed for my Nvidia Quadro K2100M card. Everything seems to work up until I actually try to run ‘cudaHashcat64’… I get the following error message: cuModuleLoad() 209.
Do you have any ideas of what might be going on? Will the driver from Part 1 work on all Nvidia cards?
No other errors have shown up during the driver installation (Part 1) or though the CUDA/pyrit/Cpyrit installation (Part 2). My display is working and after Part 1 the resolution is now correct. Let me know what additional info you may need.
Thanks!
madkel
Google found a few matches for “cuModuleLoad() 209” error. That’s your starting point. It’s a driver mismatch issue.
Saying that, if you’re serious about cuda, perhaphs Kali is not the best supported distro, it’s plagued with too many issues. (there you go, I said it).
Ubuntu works far better with cuda and all drivers ane supported without any workarounds. So simple, that I never bothered writing a guide on that. Cheers,
-BMO.
Thanks for the quick and direct response. I figured it was driver related but I was hoping there would be an easier solution… Oh well. Kali is still functional for what I need it for. Thanks again!
For some reason I was getting the cuModuleLoad() 209 when using hashcat. Cuda/nvidia drivers worked fine for pyrit. This fixed it for me in kali 1.09, Geforce gtx 560. I can now use hashcat in kali 1.09
leafpad etc/apt/sources/sources.list
Add this source – deb https://ftp.debian.org/debian wheezy-backports main contrib non-free
apt-get update
apt-get install -t wheezy-backports nvidia-kernel-dkms nvidia-cuda-toolkit nvidia-driver nvidia-xconfig
If you have done the following steps as per blackMORE Ops awesome guide, you dont have to do it again.. just reboot
nvidia-xconfig
sed ‘s/quiet/quiet nouveau.modeset=0/g’ -i /etc/default/grub
update-grub
reboot
credits to Samiuxs blog
Sorry that was leafpad etc/apt/sources.list.
The backports version of nVidia driver is 340.65 and the version of CUDA driver is 5.5.22 at this time of writing.
After following most up to date instruction, I get this error.
ERROR: cuModuleLoad() 209
after executing cudahashcat64 -b command.
Every help is really appreciate!!
Awesome tutorial – Thank you! I used this with a clean install of 1.09a and it worked perfectly.
can you help me
i had the latest kali
everything seem to work i mean gpu nvidia geforce 740 gt
when i try to use ~/cudaHashcat# ./cudaHashcat64.bin -b
cudaHashcat v1.33 starting in benchmark-mode…
Device #1: GeForce GT 740, 2047MB, 1202Mhz, 2MCU
ERROR: cuModuleLoad() 209
its gave me this error…
if i use pyrit.. i can see me geforce as cpu… and 3 other ..witch is the 4 cpu
so i dont really know where can be error
can u help me please ? i did full reinstall pyrit and cpyrit..all goes well
dhcppc1:~# pyrit list_cores
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg https://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
The following cores seem available…
#1: ‘CUDA-Device #1 ‘GeForce GT 740”
#2: ‘CPU-Core (SSE2)’
#3: ‘CPU-Core (SSE2)’
#4: ‘CPU-Core (SSE2)’
Thanks for the great how-to’s
I just tried to install the cudahashcat from the mega download, it can’s intstall on kali 1.1.0 it says it’s not a debian file.
Hi, i am trying to install it also on my debian jessie 8 but is not possible…
Thank you so much for this guide, works like a charm in Kali!
I had problem installing it in Debian 8 rc1, at install.py
i had this error -> (cpyrit/_cpyrit_cpu.c:35:26: fatal error: openssl/hmac.h: No such file or directory)
and with a bit of googling i found that it needs to
apt-get install g++
apt-get install python-dev
apt-get install zlib1g-dev
apt-get install libssl-dev
and after everything works fine
Thanks again!
Work for me.
Thanks :)
I need your help sir! i got this error i tried to google it but i dont find any solution, by the way thanks for a great tutorial it helps me a lot.
creating build/temp.linux-x86_64-2.7/cpyrit
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cpyrit/_cpyrit_cpu.c -o build/temp.linux-x86_64-2.7/cpyrit/_cpyrit_cpu.o -Wall -fno-strict-aliasing -DVERSION=”0.4.0″
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
Brolo..you are the man! Xorg was my issue the entire time. Thank You for taking the time to put this info together.
root@kali:~# pyrit list_cores
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg https://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
The following cores seem available…
#1: ‘CUDA-Device #1 ‘GeForce GTX 670M”
#2: ‘CPU-Core (SSE2)’
#3: ‘CPU-Core (SSE2)’
#4: ‘CPU-Core (SSE2)’
#5: ‘CPU-Core (SSE2)’
#6: ‘CPU-Core (SSE2)’
#7: ‘CPU-Core (SSE2)’
#8: ‘CPU-Core (SSE2)’
root@Icraker:~/cpyrit-cuda-0.4.0# python setup.py build
The CUDA compiler and headers required to build kernel were not found. Trying to continue anyway…
svn: ‘.’ is not a working copy
running build
running build_ext
/bin/sh: 1: nvcc: not found
None
Failed to execute command ‘nvcc -V’
Traceback (most recent call last):
File “setup.py”, line 175, in
setup(**setup_args)
File “/usr/lib/python2.7/distutils/core.py”, line 152, in setup
dist.run_commands()
File “/usr/lib/python2.7/distutils/dist.py”, line 953, in run_commands
self.run_command(cmd)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “/usr/lib/python2.7/distutils/command/build.py”, line 128, in run
self.run_command(cmd_name)
File “/usr/lib/python2.7/distutils/cmd.py”, line 326, in run_command
self.distribution.run_command(command)
File “/usr/lib/python2.7/distutils/dist.py”, line 972, in run_command
cmd_obj.run()
File “setup.py”, line 82, in run
raise SystemError(“Nvidia’s CUDA-compiler ‘nvcc’ can’t be ” \
SystemError: Nvidia’s CUDA-compiler ‘nvcc’ can’t be found.
this is the error i get :( ive redone and redownloaded both the pyrit and cpyrit steps.
please help somone
oops sorry guys didnt see the first step :P
Sir,
As per Step – 4 & 5 – can’t install Pyrit & Cpyrit – in Kali Linux 2.0.
With hope of good response.
Thanking you.
Give a try at my updated version:
https://github.com/JPaulMora/Pyrit
thanks!
I have been maintaining Pyrit for a while now, please try the new version here:
https://github.com/JPaulMora/Pyrit
thanks!
We’re looking into it. Thank you.
-blackMORE Operations Team.
Will this work with the current kali release?
Thanks Mr. Robot
Hi! Could someone please share any ideas on this error?
pyrit list_cores
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg https://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+
Traceback (most recent call last):
File “/usr/local/bin/pyrit”, line 6, in
pyrit_cli.Pyrit_CLI().initFromArgv()
File “/usr/local/lib/python2.7/dist-packages/pyrit_cli.py”, line 115, in initFromArgv
func(self, **options)
File “/usr/local/lib/python2.7/dist-packages/pyrit_cli.py”, line 291, in list_cores
with cpyrit.cpyrit.CPyrit() as cp:
File “/usr/local/lib/python2.7/dist-packages/cpyrit/cpyrit.py”, line 440, in __init__
self.cores.append(CUDACore(queue=self, dev_idx=dev_idx))
File “/usr/local/lib/python2.7/dist-packages/cpyrit/cpyrit.py”, line 245, in __init__
_cpyrit_cuda.CUDADevice.__init__(self, dev_idx)
SystemError: CUDA_ERROR_NO_BINARY_FOR_GPU
Thank you in advance!