Kali Linux with GPU-accelerated hashcat on FW16 -- success!

Let me start with – yes, I know, “you’re not supposed to install Kali on bare metal!” This is a machine I got with the primary intention of studying cybersecurity and with the full expectation that I’m going to mess stuff up repeatedly. There’s a reason I installed onto a BTRFS filesystem and am constantly taking snapshots :wink:

I’m going to leave detailed installation posts for others who are more knowledgeable about Linux to handle (this already seems like a pretty good guide for the basics, though written for the FW13: [RESPONDED] Kali Linux Install Stuck at Grub> Cmd Line ). I’m here to add a few words on my efforts to get the dGPU working with hashcat – these steps do not appear to hinder graphical applications using the GPU or cause any other issues with the system (though I’ll do my best to update if I find any hiccups!).

Since Kali is Debian-based, I assumed many instructions would be similar to Ubuntu, and that I could use many of the same tools to achieve my goals. After a lot of effort trying that approach… I wouldn’t bother. My recommendation is to not follow the “completion instructions” in the Ubuntu installation guide. After fully upgrading Kali, DRI_PRIME=1 will already work out of the box.

But if you install hashcat, it won’t see your dGPU. Nor will some other tools. Guides online will likely recommend that you uninstall anything related to PoCL – don’t bother, you won’t need to. Hashcat’s website specifies that you’ll need “AMDGPU” and “ROCm”, and documentation on ROCm seems to indicate that our kernel, OS, and GPU are all unsupported… but it turns out you can get it working anyway!

First, uninstall and purge amdgpu-dkms if it’s already installed, and ensure xserver-xorg-video-radeon is installed. Then, begin following the instructions here for Ubuntu 22.04, but stop after apt update!

Installing the .deb will give you some new tools, including amdgpu-install. This script will do much of what we want, but doesn’t want to work on Kali – so we need to trick it into thinking we’re running Ubuntu. Use which amdgpu-install to find it, then open with sudoedit. In the function os_release, after the line case "$ID" in, add ‘kali’, and save the script.

Remember, we don’t want to install the dkms driver, and we’re only searching for OpenCL support here. So we can use this script with sudo amdgpu-install --usecase=opencl --no-dkms, which will invoke apt with the packages we need.

And… that should do it! Hashcat should now recognize another OpenCL platform that lists the discrete GPU (as well as an apparent phantom entry for the iGPU?), and it runs successfully! Note that hashcat run in this way will not show up in the Framework team’s fantastic dGPU-detect tool, but you can verify that it is indeed using the GPU using radeontop.

Let me be clear – though I’m knowledgeable about computing and programming in general, there is a LOT I still have to learn when it comes to Linux. Your milage will likely vary if you try these instructions, and I can’t guarantee I’ll be able to help if they bork your system. But for those interested and willing to try, I figured I might as well put a resource out there that I wish I’d come across while working on all this, haha. Please do let me know if you have thoughts or advice on this, or further tips for using Kali on bare metal FW16!

2 Likes

have you tried using zluda with it? its supposed to enable cuda like performance on amd hardware, and it was something I was interested in trying, but if you try it before me, please update here, I am super interested. I am batch 6 so hopefully I will be able to try myself soon.

Good question!

I just gave it a quick shot with hashcat, and it didn’t seem to work with my admittedly limited testing. Didn’t see a difference in the devices that hashcat enumerated. No errors or anything when adding the path to the zluda files, just no perceptible difference.

I suspect that one possible incompatibility may be that the readme says explicitly not to use ROCm 6, but that’s what I’ve got installed with my approach. I’m uncertain what would be involved to attempt to downgrade, but I don’t really want to go poking around too much with something that already works, haha :sweat_smile:. I bet you’d probably have some success with a bit more fiddling than I was willing to do, though – let me know if you get it working when you get your machine!

Thanks for this, I also have hashcat running on my FW16 with the dGPU, although I used a Kali Live USB. The performance increase was incredible, went from ~132H/s to ~2500H/s.

I have a long hashing job that I need to run intermittently, and I don’t run Kali as my daily on the FW16, so I wanted to script the setup process, allowing me to boot into a live eviroment, and run one command that got me back to hashing with the dGPU. Your post was instrumental in achieving that, thank you.

I Ventoy to boot into a variety of distro’s including kali for this purpose. I kept the script on a different USB drive (the 1TB expansion card).

The script I wrote:
FW16 dGPU setup for Kali Live USB

What it does:

  1. Connects to my wifi
  2. Add the radeon repositories to apt sources.list
  3. Download the amdgpu-install .deb file
  4. Unpack the .deb file and modifies that install script to include kali
  5. Runs the amd-gpu install script
  6. Installs radeontop to confirm dGPU is being utilized
  7. Triggers my bash script that contains my hashcat job

This is running very well in live enviroment, and does not require a restart.
Three things that may be helpful if you try and do the same thing:

  1. I have statically set the driver version in the variables at the top of the script, confirm and update these.
  2. When installing the amd-gpu drivers, it will prompt you restart services, unselect and do not restart udisks2.service, or you may unmount the USB drive.
  3. hashcat needs to be run with sudo, or it won’t access the dGPU.
1 Like

heck yes! was wondering about this. In the meantime, I had set up a liveUSB version of kali for those rare moments when I need the dGPU. thanks!

I just did some benchmark test out of curiosity. Any idea why hashcat is so much faster on a Windows install with the same hardware?

I’m getting results like these:

Mode 0
Windows: 19171 MH/s
Ubuntu: 2534 MH/s

Mode 100
Windows: 7832 MH/s
Ubuntu: 1479 MH/s

Mode 1400
Windows: 3499 MH/s
Ubuntu: 639 MH/s

Hi, I have tried this and finally gotten through the admgpu installation without any errors. Thanks for that.
However, after I reboot and pass Grub I get an error message before the LUKS passphrase screen “Fatal error during GPU init” and after entering the passphrase the error “Get_CABLE_PROPERTY Failed” appears and the xserver won’t start. I can start a session with startx after logging in but the driver doesn’t seem to load. Here is the output of lspci -k:

03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 33 [Radeon RX 7600/7600 XT/7600M XT/7600S/7700S / PRO W7600] (rev c1)
DeviceName: Realtek
Subsystem: Framework Computer Inc. Device 0007
Kernel modules: amdgpu

Also a few other relevant outputs that may help:

dmesg | grep modesetting
[ 2.374673] [drm] amdgpu kernel modesetting enabled.
[ 2.380760] [drm] initializing kernel modesetting (IP DISCOVERY 0x1002:0x7480 0xF111:0x0007 0xC1).
[ 2.426370] [drm] initializing kernel modesetting (IP DISCOVERY 0x1002:0x15BF 0xF111:0x0005 0xC1).

sudo hashcat -I
hashcat (v6.2.6) starting in backend information mode

OpenCL Info:

OpenCL Platform ID #1
Vendor…: Advanced Micro Devices, Inc.
Name…: AMD Accelerated Parallel Processing
Version.: OpenCL 2.1 AMD-APP (3625.0)

OpenCL Platform ID #2
Vendor…: The pocl project
Name…: Portable Computing Language
Version.: OpenCL 3.0 PoCL 3.1+debian Linux, None+Asserts, RELOC, SPIR, LLVM 14.0.6, SLEEF, DISTRO, POCL_DEBUG

Backend Device ID #1
Type…: CPU
Vendor.ID…: 1
Vendor…: AuthenticAMD
Name…: pthread-skylake-avx512-AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Version…: OpenCL 3.0 PoCL HSTR: pthread-x86_64-pc-linux-gnu-skylake-avx512
Processor(s)…: 16
Clock…: 5263
Memory.Total…: 60049 MB (limited to 8192 MB allocatable in one block)
Memory.Free…: 29992 MB
Local.Memory…: 1024 KB
OpenCL.Version.: OpenCL C 1.2 PoCL
Driver.Version.: 3.1+debian

And radeontop shows unknown card with everything at 100%

sudo radeontop
Failed to find DRM devices: error 2 (No such file or directory)
Failed to open DRM node, no VRAM support.
Unknown Radeon card. <= R500 won’t work, new cards might.
Collecting data, please wait…