Sitemap

How I Replaced Virtual Machines with WSL for a Faster, GPU-Powered Linux Workflow

8 min readOct 19, 2025
Press enter or click to view image in full size

Calling all cybersecurity students that enjoy doing CTF (Capture the Flag) events like NCL (National Cyber League).

If you’ve ever used VirtualBox or VMware for running Linux, you know how clunky the experience can get — slow performance, huge disk images, and the constant hassle of transferring files between the host and guest systems. That’s why I’ve ditched traditional virtual machines entirely in favor of Windows Subsystem for Linux (WSL). With WSL, my Linux environment runs natively alongside Windows, making it incredibly easy and seamless to move files back and forth. Even better, installing the CUDA toolkit means I can tap directly into my GPU for tools like Hashcat, unlocking massive speed gains compared to CPU-only processing. It’s lightweight, powerful, and the most convenient setup I’ve ever used for both development and cybersecurity work.

Setting up WSL

From your windows search bar at the bottom type ‘features’ and you should see Turn Windows features on or off, click that.

Scroll down and put a checkmark next to Virtual Machine Platform and Windows Subsystem for Linux.

Click ok and restart your machine. Make sure you have the Windows Terminal app installed from Windows Store.

After you restarted, open up command prompt and type:

wsl --install

This might take a few minutes to go through the process. By default it will install Ubuntu. During install it will ask you for a username, go ahead and put whatever you want for that. After it’s install let’s install kali linux.

Installing Kali Linux on WSL

At this point you should have Ubuntu installed. At the top in Windows Terminal, click the drop down arrow and go back to command prompt.

In Command Prompt:

wsl --install kali-linux

You are going to go through a similar process by creating a username and a bunch of other setup options, just click the default options and accept through them all. Once kali is installed, run these commands:

sudo apt update
sudo apt full-upgrade -y

Okay, this part is important. When you install kali linux on WSL it comes with the minimal installation and not all the tools are installed. If you have enough storage to install all the tools, I recommend installing everything by the next step. If you want to install each and every tool as you go, you can stop here. To install all the tools, do this next command — warning this part does take a while. You might see an option towards the end like 82% mark about it asking you to set up a tripwire password, I recommend making that the same as your kali username password so you don’t forget it. Type this command in your kali linux terminal:

 sudo apt install -y kali-linux-everything

Alright! Now you have kali linux fully loaded with all the tools!

Before we install CUDA, I want you to run this command, it will show your main device hashcat uses and you will most likely see your CPU as the main device.

hashcat -I

The next part will help change that so hashcat uses your GPU and not your CPU. You are going to be amazed at how much of a difference this will make for cracking passwords. Let’s goooo!

Installing CUDA drivers for NVIDIA graphic cards for Hashcat

This part is important. By default on most virtual machines like virtualbox and vmware, it uses your CPU by default — which is bad for speed and performance. You will want Hashcat to use your graphic card as main device to increase the performance. Example, instead of taking 30 minutes to run a simple cracking session using rockyou.txt wordlist, it will take you a few seconds!

Click the link above and follow the parts that I clicked on, you will see them in white font Linux > x86_64 > WSL-Ubuntu > 2.0 > deb (local)

Press enter or click to view image in full size

You will see installation intructions appear underneath, copy all the steps and paste it into a new file in your home directory in kali linux, call the file cuda.sh.

nano cuda.sh

Then paste the instructions in cuda.sh (make sure you get the following code from the website as this will change to a new version — version 13.0 is currently out)

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/13.0.2/local_installers/cuda-repo-wsl-ubuntu-13-0-local_13.0.2-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-13-0-local_13.0.2-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-13-0-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-0

You will need to make the cuda.sh executable and then run it.

chmod +x cuda.sh
./cuda.sh

You will need to add an enviromental variable to your bashrc script:

nano ~/.bashrc

Scroll to the very bottom, add some new blank lines and add this to the very bottom:

export PATH=/usr/local/cuda-13.0/bin:$PATH

Notice how I mentioned above that we are installing version 13.0, so we will put 13.0 there. Make sure you change that accordingly to what version you are doing by the time you see this, as it will change.

Save the file and run

 source ~/.bashrc

Okay, now you will want to run 2 commands to make sure the CUDA drivers were installed properly.

nvcc --version

Here is an example of mine, this is showing version 12.8 installed because I have not updated to version 13.0 while writing this, so you should see 13.0 where you see 12.8.

nvidia-smi

It should be similar to these results:

Press enter or click to view image in full size

If you see both those screens, you should have CUDA fully installed, woohoo! Finally, let’s check to see if hashcat is reading our GPU as our default device:

hashcat -I
Press enter or click to view image in full size

Notice for Device ID #01 it says NVIDIA GeForce RTX 5090, which is my GPU. If you see CPU there, then hashcat is using your CPU and not your GPU, not good!

Now run some hashcat commands and see how much faster it is!

Copying files from host machine to WSL Kali Linux

Here is the fun part. You can now move files in and out of your virtual machine WSL kali linux quick and easy. Let’s say you want to move a file (test.txt) from your /home/yourusernamehere to your desktop on windows. If you are in your kali linux WSL terminal home directory:

cp test.txt /mnt/c/Users/WindowsUsernameHere/Desktop

Now you will have your test.txt file shared to your desktop. You will also see a way to get inside your virtual machine environment by using explorer on the left hand side:

This makes it convenient to use your terminal inside windows without this other bloated software taking up all the space on your screen. You don’t need virtualbox or vmware, all you need is a terminal with WSL

Uninstall Ubuntu on WSL

Since we installed kali linux and won’t be using Ubuntu, we can uninstall it. Open up command prompt:

wsl --unregister Ubuntu

Exporting / importing WSL

A great feature is the ability to backup your WSL virtual machine environment. A scenario you might encounter is you want to do a fresh install of windows to default settings but don’t want to lose all your wsl related stuff. To backup kali linux, in command prompt type:

wsl --export kali-linux "D:\Backups\kali-linux.tar"

This does take a while, especially if you installed the everything version of kali linux with all the tools.

To import, run this command in command prompt:

wsl --import kali-linux "D:\WSL\kali" "D:\Backups\kali-linux.tar" --version 2

Note:
D:\WSL\kali — this is where you want to install it at, you can choose anywhere.

Having kali linux as your default terminal profile

Once you use Windows Terminal primarly for kali linux, you will want kali linux to come up by default every time you open the Windows Terminal app. You can do this my clicking the drop down menu and settings. Under startup, select kali-linux from the drop down menu and click save.

Press enter or click to view image in full size

Other Linux flavors you can install on WSL

wsl --list --online

Let’s say you want to install another virtual machine on WSL for FedoraLinux-42, you would do the same steps similar to kali-linux:

wsl --install FedoraLinux-42

You will want to match the name on the left.

TROUBLESHOOTING: Your GPU might not be recognized after restart

I recommend restarting your whole computer once you made it this far. Check to see if hashcat is still recognizing your GPU.

$ hashcat -I

If you still see your GPU, then you are good. If it somehow stopped working then apply the next step.

Create a new script (leave the other one in your home directory as an alternative manual method). $ sudo nano /etc/profile.d/fix_cuda.sh and add the following:

#!/bin/bash
# Fix CUDA GPU issue in WSL
if [ -d /usr/lib/wsl/lib ]; then
cd /usr/lib/wsl/lib
sudo rm -f libcuda.so libcuda.so.1
sudo ln -s libcuda.so.1.1 libcuda.so.1
sudo ln -s libcuda.so.1 libcuda.so
sudo ldconfig
cd ~
fi

Save and exit the editor (Ctrl + X, then Y, and Enter). Make the script executable: $ sudo chmod +x /etc/profile.d/fix_cuda.sh

That script fixes a common CUDA library linking issue in WSL — especially when WSL can see your GPU but programs like Hashcat, PyTorch, or TensorFlow fail to load CUDA properly. In some WSL setups (especially after Windows updates or new CUDA installations),
the symbolic links /usr/lib/wsl/lib/libcuda.so and /usr/lib/wsl/lib/libcuda.so.1 either: don’t exist, or point to the wrong target (libcuda.so.1.1 being the real one provided by Windows).

When that happens, CUDA-enabled apps can’t locate your GPU and throw errors like:

libcuda.so.1: cannot open shared object file: No such file or directory

This script repairs those broken links. After you done this, restart your computer fully and it should fix it.

--

--

diGi
diGi

Written by diGi

20+ years as a web developer turned cybersecurity professional. 2X NCL trophy winner & 1st place in MWCC 2023.

No responses yet