This notebook-style guide walks you through installing WSL2, Kali Linux, and Win-KeX (Kali GUI) on Windows, including recommended prompt answers and common fixes.
How to check
- Open Task Manager → Performance → CPU
- Look for: Virtualization: Enabled
If it’s disabled, enable virtualization in your BIOS/UEFI settings.
If you have NVIDIA, the recommended option is Studio Driver:
- Supports WSL GPU acceleration, CUDA development, and creative apps
- Occasional gaming still works fine (only very new games may miss day-one optimizations)
Check current driver date
- Task Manager → Performance → GPU → Driver date
Open:
- Press the Windows key → search “Turn Windows features on or off”
Enable:
- Virtual Machine Platform
- Windows Subsystem for Linux
Open PowerShell (Admin) and run:
wsl --update
wsl --versionCheck WSL status:
wslIf no distro is installed yet, it will tell you no distro exists.
List available WSL distros:
wsl.exe --list --onlineInstall Kali:
wsl --install -d kali-linuxSet default distro:
wsl --setdefault kali-linuxStart Kali using either command:
wslor:
bashInside the Kali WSL terminal, run:
sudo apt updateIf sudo apt update shows mirror/network errors:
sudo nano /etc/apt/sources.listdeb https://ftp.halifax.rwth-aachen.de/kali kali-rolling main contrib non-free non-free-firmware
Then run:
sudo apt updateInside Kali:
sudo apt install kali-win-kexStart KeX:
kex --winAnswer: n
Why n is correct:
y= view-only (cannot click or type)n= full control (keyboard + mouse)
For pentesting/labs/tools, you need full control.
What happens next:
- KeX server starts
- Windows KeX window launches automatically
- Kali desktop appears
- Download & Install TigerVNC: https://sourceforge.net/projects/tigervnc/
Recommended lighter daily usage (optional):
kex --slIf you encounter errors when using Win‑KeX or related tools, review the specific cases below for common causes and step-by-step recovery instructions. Follow the checklist in each subsection before reporting bugs or seeking help.
What this error really means
Win-KeX (via TigerVNC Viewer) may show:
This message can be either normal behavior or a real KeX failure. The key is when it happens.
This is expected if you:
- Shut down Kali (e.g.,
sudo poweroff) - Stop KeX (
kex --stop) - Shut down WSL (
wsl --shutdown) - While the TigerVNC Viewer window is still open
What’s happening
- The VNC server stopped intentionally
- Windows detects the connection is gone
- TigerVNC reports it as 10053 (notification, not a crash)
Correct action
- Click No (do not reconnect)
- Close TigerVNC Viewer
- Do nothing else
Do NOT
- Click “Reconnect”
- Run recovery commands
- Reinstall Win-KeX
This is the critical case. Typical symptoms:
- KeX disconnects immediately after launch
- “Reconnect” loops endlessly
- The GUI never stays open
Common causes:
- Corrupted/stale VNC socket files
- Broken KeX user config
- Interrupted KeX startup
- Security software interfering on the Windows side
Recovery checklist (ONLY for Case B)
Run these in order from a fresh Kali shell:
- Stop KeX cleanly
kex --stop- Kill any ghost VNC / KeX processes
pkill Xtigervnc
pkill kex- Remove broken VNC display files
rm -rf ~/.vnc- Remove KeX user configuration
rm -rf ~/.config/kex- Reset the KeX password
kex --passwd- When asked
Viewonly password (y/n)?answer:n - Use a 6–8 character password
- Start KeX in the most stable mode
kex --win --forceImportant rule (do NOT skip)
If 10053 is happening during a real crash, don’t click “Reconnect” in TigerVNC. Close the viewer and restart KeX cleanly after completing the checklist.
Quick decision table
| Situation | What to do |
|---|---|
10053 after shutdown / kex --stop |
Click No, close TigerVNC (normal) |
| 10053 during KeX startup | Click YES (once), Run the recovery checklist above |
| 10061 (connection refused) | Click No, Restart KeX and/or run wsl --shutdown, then try again |
| GUI opens normally | Ignore past errors |
The “Wayland compositor does not support required protocol wlr-layer-shell” notice is purely cosmetic. It appears because the Xfce notification daemon briefly probes Wayland protocols while the rest of KeX runs on X11. The session keeps working despite the message, but you can silence it.
Optional: permanently suppress the popup
mkdir -p ~/.config/autostartcp /etc/xdg/autostart/xfce4-notifyd.desktop ~/.config/autostart/nano ~/.config/autostart/xfce4-notifyd.desktopand change (or add)Hidden=false→Hidden=true.- Save and exit the editor.
- Restart the KeX GUI with
kex --stopfollowed bykex --win.
Once those lines are updated, the notification daemon will stay quiet for good.
kex --status # check running status
kex --stop # stop KeX
kex --win # full desktop
kex --sl # seamless modeStop KeX:
kex --stopIn the KeX Linux terminal (or Kali terminal), run:
sudo apt install kali-linux-largeChoose: Yes
Why Yes is correct:
- Kismet needs privileges for:
- Monitor mode
- Packet capture
- WiFi analysis workflows
- Selecting Yes:
- Sets permissions safely
- You don’t need to run Kismet as root every time
- Typical/recommended on Kali
Choose: Yes
Why Yes is right:
- Lets you run Wireshark/Tshark without
sudo - Safer than running full Wireshark as root
- Recommended setup
What happens:
- Uses group
wireshark - Capture handled by
dumpcap(minimal privileged component)
IMPORTANT after installation (don’t skip)
Check group membership:
groupsIf you see wireshark:
- You’re done.
If you do NOT see wireshark, run:
sudo usermod -aG wireshark $USERThen restart WSL:
wsl --shutdownVerify again (reopen Kali):
groupsYou should see:
wireshark
Select: standalone
Why standalone:
- More stable and faster for pentesting/tools
- Doesn’t spawn a new process per connection
- Recommended for Kali usage
Rule of thumb:
- Pentesting/labs/tools → standalone
- Rare/minimal server traffic → inetd
kex --stopEffect:
- Stops Win-KeX server and closes KeX window(s)
- Kali WSL instance keeps running
Inside Kali:
exit(or logout)
Effect:
- Closes that session
- WSL may still remain running in the background
PowerShell:
wsl --terminate kali-linuxShorthand:
wsl -t kali-linuxEffect:
- Immediately ends that distro process (stops services, closes shells)
PowerShell:
wsl --shutdownEffect:
- Stops WSL2 utility VM and all running distros
- Good after big installs or to free resources
Example:
kex --winYou may see:
Command 'kex' not found, but can be installed with: sudo apt install kali-win-kex- During install/reinstall:
Error: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Meaning:
- The package system was left unfinished, so
aptis blocked until repaired.
Run inside Kali:
sudo dpkg --configure -asudo apt --fix-broken installsudo apt updatesudo apt install --reinstall kali-win-kexkex --winNote:
- First run will ask you to set a KeX password.







