4

When I run the kex, it gives this error

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.
    
David Buck
  • 3,752
  • 35
  • 31
  • 35
Ismoil
  • 41
  • 1
  • 1
  • 2

5 Answers5

12

Following Instructions worked for me, remount /tmp/.X11-unix with rw option:

sudo mount -o remount,rw /tmp/.X11-unix

https://github.com/microsoft/WSL/issues/9303#issuecomment-1345615675

mechDeveloper
  • 331
  • 3
  • 8
0

i solved the same problem

sudo apt remove -y kali-win-kex && sudo apt install -y kali-win-kex
belmel ahmed
  • 176
  • 1
  • 5
0

I also was unable to bring up KEX, and found out it was do to an oversight with the WSL version

It turns out I had the KALI BOX still on WSL v1, fixing to WSL v2 fixed it for me

upgrade it first to version 2 using the following command:

wsl --set-version kali-linux 2

When upgrading the distro to WSL2, you may be prompted to download and install the latest Linux Kernel, which you should do.

You can then enter the wsl -l -v command again to confirm that Kali Linux is now configured as a WSL2 distribution.

Now launch Kali Linux and run the following commands to prep the distribution with the latest updates and required files.

sudo apt update

sudo apt dist-upgrade

Source: https://www.bleepingcomputer.com/news/security/kali-linux-gets-a-gui-desktop-in-windows-subsystem-for-linux/

0

These steps solved it for me:

  1. sudo su (some commands require root)
  2. cd /tmp
  3. ls -a
  4. Delete all .XX-lock files you can find (just do rm .X1-lock, rm .X2-lock ...)
  5. rm -r /tmp/.X11-unix
  6. run vncserver
  7. run kex

Enjoy

-1

After switching to the Windows App version of WSL with
wsl.exe --update
I also had this issue.

This fixed the issue:

sudo apt remove -y kali-win-kex && sudo apt install -y kali-win-kex
sudo apt-get update
sudo apt-get upgrade
sudo su
umount /tmp/X11-unix
rm -r /tmp/.X11-unix
rm /tmp/.X1-lock
exit
sudo rm /home/YOURUSERNAME/.Xauthority
vncserver
kex

Not all steps are necessary..

Somehow

kex --win -s
fixed the audio so I have audio now. So input that if you have problems with the audio and WSL. Windows is asking you for permission for audiopulse. Confirm and then you would have the audio..

Good luck and a good new year.

Jeff
  • 1
  • So if you have also no audio with Kali Linux and WSL on Windows just open cmd.exe and write: wsl.exe --update and then in Kali Linux write in your terminal: kex --win -s. Fixed two issues then.. – Jeff Dec 31 '22 at 10:44