How to fix the error Error connecting to the KeX server? [closed]
Asked Answered
D

5

5

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.
    
Dostie answered 4/1, 2022 at 11:7 Comment(0)
O
13

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

Oswaldooswalt answered 27/12, 2022 at 3:22 Comment(0)
S
1

i solved the same problem

sudo apt remove -y kali-win-kex && sudo apt install -y kali-win-kex
Streusel answered 7/2, 2022 at 3:50 Comment(0)
S
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/

Slowdown answered 27/6, 2022 at 16:48 Comment(0)
N
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

Needlework answered 19/11, 2022 at 21:34 Comment(0)
B
-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.

Bellow answered 31/12, 2022 at 10:40 Comment(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..Bellow

© 2022 - 2024 — McMap. All rights reserved.