How To Install: NVIDIA on Kali Linux and use CUDA

Disclaimer
Please, be aware that this solution is one of many as it all depends on your configuration, what has happened previously, etc… I take no responsibility for any damage to your system, all of the information on my blog is provided without any warranties, they are tested by me and they are working solutions for me, but… “your mileage may vary”…

A little bit of history…

I love Kali Linux (previously Backtrack), there are no “buts” about it, but… I’m not that great with all things Linux (I will get there, one day πŸ˜‰ ) and things I’d love to do, are kind of “more advanced” than I would like to participate with.

One of them is NVIDIA card installation: standard Kali does have Linux drivers, but they are without hardware assistance, so basically you know you can use CUDA/OpenCL, but not yet πŸ˜‰

Why do I need CUDA/OpenCL? I love to play with passwords, WiFi… you got it. To test the strength of encryption, I use Hashcat program, which can accelerate cracking via OpenCL graphics card hardware assistance. That’s why I need full NVIDIA driver to get that hardware assistance.

To write this small guide, I was forced twice. The first time, I’ve installed my 3 NVIDIA cards when I build my workstation about 2 years ago: GTX 1070 8GB, 2x GTX 1060 6GB. It was doing about 450kH/s cracking WPA2. Not bad, consuming about 380W totally (whole system).

The second time is now: I just purchased GTX 1080Ti 11GB, to replace one of the GTX 1060s. This card has more oomph than my total system previously… about 576kH/s alone… The plan is to have 2 of them… or 3 if I can force myself to find a good reason to do it…

Problem is that I’ve completely forgotten how I’ve done it… and how much it can be a pain in the butt if it cannot build properly…

NVIDIA Driver

Few steps are required to install the driver (in my case it’s Kali Linux 2018.3 x64 distribution):

  • Download the driver to Home/Downloads:
http://uk.download.nvidia.com/XFree86/Linux-x86_64/410.73/NVIDIA-Linux-x86_64-410.73.run
  • Change the name to something simpler like NVIDIA-Linux.run
  • Open terminal and type
apt update && apt dist-upgrade -y && reboot
  • If you haven’t updated your Kali installation in some time, you will receive a GPG error about the repository key being expired, try this:
wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add
  • After upgrading the whole system if necessary and rebooting your computer, next thing is updating Linux headers:
apt install linux-headers-$(uname -r)
  • Once Linux headers are installed, we can type in terminal:
cd Downloads
sudo sh NVIDIA-Linux.run
  • After installation & reboot, you should be ready to go…

What if…

Yeah, as always my installation was fine, but I could not boot to Kali desktop, it sits on the boot without any movement… again.

Press Ctrl+Alt+F2..F5 to start a new terminal and log into with root. Type

apt update && apt full-upgrade -y && reboot

It helped, but I got the login page into a loop, no matter how many times I typed my root password… It goes back to login page… here we go, back to the terminal (Ctrl+Alt+F2):

dpkg --configure -a

apt-get --reinstall install gdm3

apt-get --reinstall install gnome

If reinstall will fail with any of them try:

apt-get update --fix-missing

…and try to reinstall failed package again.

Finally, reboot the computer and try to log in to desktop. Working? Great! No…? Don’t give up, you can always reinstall the system and start from beginning πŸ˜‰

Good luck!

Last thing…

If you, by any chance, have a problem with Hashcat telling you about time out, there is a solution to that too πŸ˜‰

WARNING! Kernel exec timeout is not disabled, it might cause you errors of code CL_OUT_OF_RESOURCES
>              See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch

Since that Kali 2018.3 is based on Kernel >3.9, it will not use Xorg.conf as before, we have to add a new file for NVIDIA driver to change settings. They are in the folder

/usr/share/x11/xorg.conf.d/

Create a new file named

20-nvidia.conf

inside add those lines:

Section "Device"
    Identifier "MyGPU"
    Driver "nvidia"
    Option "Interactive" "0"
EndSection

Save and reset the computer, after that Hashcat should not complain again.

Ufff… so much hustle with something like that… but it’s worth it πŸ˜‰ Picture below showing my configuration at the moment, including changed power envelopes sheaving some 100W of power on full blast without too much loss in cracking power πŸ˜‰

UPDATE:

Christmas this year came to me earlier: Finally got second NVIDIA 1080Ti!!!

NICE!

Resources:

  1. https://www.kali.org/releases/kali-linux-2018-3-release/
  2. https://docs.kali.org/general-use/install-nvidia-drivers-on-kali-linux
  3. https://medium.com/@jamesmacwhite/installing-the-nvidia-drivers-in-kali-linux-cd3560258e24
  4. https://www.youtube.com/watch?v=8dZkQxasuIo
  5. https://hashcat.net/wiki/doku.php?id=timeout_patch

You may also like...