Requirements:
- Kali distro is installed
- KeX is installed
- Kali is WSL version 2
- Coffee is ready for consumption
Time to time the Kali desktop on WSL stops working and spits out the following message:
Error connecting to the KeX server.
Please try "kex start" to start the service.
If the server fails to start, please try "kex kill" or restart your WSL2 session and try again.
Of course the “solution” from the error message does not work.
Update 2023. 01. 12.
In the terminal remounting the /tmp/.X11-unix solved my KeX connection error problem.
sudo mount -o remount,rw /tmp/.X11-unix
My old solution
The “old” solution I used is below.
In the Kali terminal:
sudo rm -rf /tmp/.X1-lock
Then in PowerShell I shut down every running instance:
wsl --shutdown
After it starting a Kali will be able to start the TigerVNC server and the connection will work. Just use
kex
If you have a comment or other opinion, visit Tom’s IT Cafe Discord Server and share it!