I have been able to use win-kex for a long time until today. Now I am having an issue where running kex gives me the following 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. However, I am able to run sudo kex and it works fine, minus that I am now logged in as root. Weirdly as well, I am able to run kex --esm with very poor performance. It seems like such a weird error that I figured it can't hurt to ask here. Thank you in advance for the help!


2 Answers 2


Try this:

sudo kex kill
sudo kex start

Now you must know what your KeX type is, then look here and go to down in "Run Win-KeX":


My KeX type, for example, is: kex --esm --ip -s (ESM = Enhanced Session Mode), but your KeX can be different.

  • Why do you tell the user to look in the “Run Win-KeX” section of the document,  but then link to the “Optional Steps” section?  And how does knowing the “KeX type” relate to your answer? … … … … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. Dec 26, 2022 at 20:40

I was able to fix it on my own by modifying the executable for KeX. For some unknown reason the virtual "screen" had become locked by TigerVNC. The fix was to change the screen variable from defaulting to 1, to defaulting to 2. This may be a bad workaround, but I was tired and it worked. Will update if that changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.