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, I test them 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 in.

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 the Hashcat program, which can accelerate cracking via Opencl graphics card hardware assistance. That’s why I need the full NVIDIA driver to get that hardware assistance.

To write this small guide, I was forced twice. The first time, I installed my 3 NVIDIA cards when I built my workstation about 2 years ago: GTX 1070 8GB, 2x GTX 1060 6 GB. 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:
https://us.download.nvidia.com/XFree86/Linux-x86_64/570.144/NVIDIA-Linux-x86_64-570.144.run
  • Change the name to something simpler, like NVIDIA-Linux.run
  • Open a 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 an expired repository key. 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, the next step is to update Linux headers:
apt install linux-headers-$(uname -r)
  • Once Linux headers are installed, we can type in the 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 in as 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 the failed package again.

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

Good luck!

Last thing…

If you, by any chance, have a problem with Hashcat telling you about timeout, 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 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 the 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, and then Hashcat should no longer complain.

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

UPDATE:

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

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...